• 0

[PHP] how to echo any text including brackets?


Question

Well i need to echo this exact text and keep the same formatting

e(72,0,0,"-",false,"nav9",

how can i store that in a variable without getting unexpected bracket errors when i try to echo it

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
Well i need to echo this exact text and keep the same formatting

e(72,0,0,"-",false,"nav9",

how can i store that in a variable without getting unexpected bracket errors when i try to echo it

Store it as a string:

$string = 'e(72,0,0,"-",false,"nav9",';
echo $string;

Link to comment
Share on other sites

  • 0

Yes, I use to do what ivanz said with <<<EOF

print &lt;&lt;&lt;EOF
e(72,0,0,"-",false,"nav9",
EOF;

It is necessary to have not any blank spaces after <<<EOF and before EOF; else you will get a parse error.

Another (but more difficult) way is to use escape character \

print "e(72,0,0,\"-\",false,\"nav9\",";

or (as already russelc said) you can use single quotes.

You can enclose double quotation marks within single quotation marks and vice versa.

Edited by ckgni
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.