Monthly Archives: September 2011

php function variables GOTCHA

Note:

When you are using tricky-slick variable variables with php ( ${$varName} ) and you’re trying to do it from within a function, make SURE the variable’s name who you’re trying to get is not OUTSIDE the function – if it is, you’ll spend 3 hours trying to figure out how that variable could possibly not be defined. teh heh. Wish I weren’t such a newbie!

php heredoc syntax GOTCHA

 

If you are using the heredoc syntax in php
[example:

echo <<< EOT formatted spaceEOT;

]

and you find yourself getting the following error:
parse error: syntax error, unexpected $end in (document.php) on line #
then chances are you have added a space or tab AFTER the last EOT;
I knew it was important to have no spaces and such BEFORE it on the same line, but turns out you can’t have spaces afterwards either! So watch out.