Full disclosure - I've been away from PHP for a while so bought a book to refresh and have been going through it. When I run one of the simple scripts to illustrate "variable variables" I get the infamous "unexpected T_VARIABLE" parse error. Specifially the error I get is "Parse error: syntax error, unexpected '$temp' (T_VARIABLE) in ... "
I did look at about a dozen similar questions but none of those threads helped with this particular code.
Here is the code in question:
<?php
$numnames = 15;
for($i=1; $i <= $numnames; $i++){
$temp = “name$i”;
echo htmlspecialchars($$temp).’<br />’;
}
?>
What I would expect is something like this:
name1 name2 name3 . . . name15 I think all the brackets and parens are closed properly and semicolons are all in place (I think). Any ideas why I'm getting this error?