[nycphp-talk] New to group and array question
David Krings
ramons at gmx.net
Sun Sep 10 20:27:01 EDT 2006
Hello,
my name is David and I am new in this group. I do some PHP for fun for my
private web site and well, not to bore you with more details about me, here
is my question. I always stumble across an odd thing with arrays. I read in
many documentations and books that one should use the single quotes when
referencing to an array element, such as $array['element']. Generally, this
works fine and I use it that way, but it always fails when using it in echo
or header statements (and probably a few others). The error I receive is
parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or
T_VARIABLE or T_NUM_STRING.
I know how to get around this parse error by omitting the single quotes
($array[element] instead of $array['element']), but I somehow am under the
impression as if this isn't really the way to do it. I could assign it to a
variable each time, but that is quite annoying (but maybe the right thing
to do?).
What is the significance of the single quotes? What is the expert advice on
using or not using them? How would I package the single quote in an echo or
header statement?
Any enlightenment is greatly appreciated.
David
More information about the talk
mailing list