Escape Sequences and HEREDOC Problem
Posted: Thu Aug 09, 2007 11:34 am
I'm new to PHP and I recently installed the xampp installer on my computer (includes PHP Ver. 5.2.3) and noticed that only some of the escape sequences work while other don't.
I have found that the following escape sequences don't work on my machine:
\n
\r
\t
However...the \\ , \$ , \" , octal and hex notation sequences work. In addition, the HEREDOC does not work on my computer either.
The following is an example of my test.php code followed by the output:
Code
<?php
echo "I purchsed the \"best\" burger on the planet \n for only \$2 \r while my fried \t Eric\\Erico sat on my chair"."<br>";
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
print $str;
?>
Output
I purchsed the "best" burger on the planet for only $2 while my fried Eric\Erico sat on my chair
Example of string spanning multiple lines using heredoc syntax.
If you know how to fix this problem please help.....
Thanks
Isaac.
I have found that the following escape sequences don't work on my machine:
\n
\r
\t
However...the \\ , \$ , \" , octal and hex notation sequences work. In addition, the HEREDOC does not work on my computer either.
The following is an example of my test.php code followed by the output:
Code
<?php
echo "I purchsed the \"best\" burger on the planet \n for only \$2 \r while my fried \t Eric\\Erico sat on my chair"."<br>";
$str = <<<EOD
Example of string
spanning multiple lines
using heredoc syntax.
EOD;
print $str;
?>
Output
I purchsed the "best" burger on the planet for only $2 while my fried Eric\Erico sat on my chair
Example of string spanning multiple lines using heredoc syntax.
If you know how to fix this problem please help.....
Thanks
Isaac.