[nycphp-talk] Variables syntax
Aaron Fischer
agfische at email.smith.edu
Fri Oct 28 16:32:11 EDT 2005
Joseph Crawford wrote:
>
> Version A works because of the {} it evaluates the variable, however
> version A would work even without the {}
>
> The reason being is because when using double quotes variables are
> evaluated before being printed.
>
On my server, version A without {} produces errors when the script runs:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
(home/filepath/filename.php) on line 45
To confirm, Version A is when the var is inside a double quoted string,
with single quotes around the array['varname']
> Version C is the same type i use because from my understanding using
> double quotes is bad because it takes longer processing to evaluate
> the variables when they are injected into a string in that manner,
> maybe i am wrong and just typing more than i have to.
Interesting. I hadn't seen mention of that in my books. It's just
further confirmation that I need more books! =)
Thanks,
-Aaron
More information about the talk
mailing list