Posted by sk on 10/06/06 15:00
The following line is the output from the below.
foo is 2foo is $foofoo is 2 foo is $foo\n
$foo = 2;
echo "foo is $foo"; // this prints: foo is 2
echo 'foo is $foo'; // this prints: foo is $foo
echo "foo is $foo\n"; // this prints: foo is 2 (with a new-line)
echo 'foo is $foo\n'; // this prints: foo is $foo\n
As you can see, no new-line.
petersprc@gmail.com wrote:
> Can you paste the code that isn't working? The zend.com tutorial is
> exactly right.
>
> sk wrote:
>
>>According to zend.com
>>
>>Double and single quoted strings are handled differently by PHP. Double
>>quoted strings are interpreted while single quoted strings are treated
>>exactly as written. For example:
>>
>>$foo = 2;
>>echo "foo is $foo"; // this prints: foo is 2
>>echo 'foo is $foo'; // this prints: foo is $foo
>>echo "foo is $foo\n"; // this prints: foo is 2 (with a new-line)
>>echo 'foo is $foo\n'; // this prints: foo is $foo\n
>>
>>I can not get this to work.
>
>
[Back to original message]
|