Internet Posted February 11, 2008 Share Posted February 11, 2008 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 More sharing options...
0 russellc Posted February 11, 2008 Share Posted February 11, 2008 To echo: echo 'e(72,0,0,"-",false,"nav9",'; To store in a variable: $varName = 'e(72,0,0,"-",false,"nav9",'; echo $varName; Link to comment Share on other sites More sharing options...
0 stereopixels Posted February 11, 2008 Share Posted February 11, 2008 $variableName = 'e(72,0,0,"-",false,"nav9",' Using single quotes around it should work. Link to comment Share on other sites More sharing options...
0 FlibbyFlobby Posted February 11, 2008 Share Posted February 11, 2008 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 More sharing options...
0 zivan56 Posted February 11, 2008 Share Posted February 11, 2008 echo <<<END Whatever you want as long as line does not start with END and semicolon END; $test = <<<END .... Also works. Link to comment Share on other sites More sharing options...
0 ckgni Posted February 12, 2008 Share Posted February 12, 2008 (edited) Yes, I use to do what ivanz said with <<<EOF print <<<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 February 12, 2008 by ckgni Link to comment Share on other sites More sharing options...
Question
Internet
Well i need to echo this exact text and keep the same formatting
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