Jump to content
xisto Community
Sign in to follow this  
jlhaslip

Php Escaped Control Characters And Windows they arent working for me.

Recommended Posts

In php coding, when you escape certain characters, they have an impact on the output of an echo'd or printed string. ie "\r\n\t" should give you a new line and a tab before outputting the content for a line of printing. They vary by OS, I know, but I have tried all the variations I can think of and can't seem to control output using them. Believe me, I have tried multiple variations and nothing works for me.I have checked the php.ini file for settings but I can't find where you can modify them.So the question is : Where do i look to confirm the settings for using these Control Characters in the php parser or config files?Anyone know? And thanks in advance.

Share this post


Link to post
Share on other sites

What exactly are you trying to output, and what are you trying to view it in? A web browser simply ignores newlines for formatting in an HTML document, generally treating them simply as a space. Try setting the Content-Type header to text/plain or using the preformatted tag (<pre>), or just add a '<br>' to your string.

Share this post


Link to post
Share on other sites

If that was the answer, I so totally didn't understand the question. The special characters are used for formating text only. They are generally used in PHP to format the outputed HTML like so:

This PHP:

echo "<body>\n\t<table>\n\t\t<tr>\n\t\t\t<td>\n\t\t\t\tContent Here!<br />\n\t\t\t\tMore content here!\n\t\t\t</td>\n\t\t</tr>\n\t</table>\n</body>";

Would output this HTML:
<body>	<table>		<tr>			<td>				Content Here!<br />				More content here!			</td>		</tr>	</table></body>

Which after the browser displays it would look like this:

Content Here!More content here!


I use this to format my HTML in a way that makes it more organized and easier to read later. Makes debugging much easier.

This is also used for line breaks and tabs in the HTML textarea object.

Hope this helps. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.