[thelist] PHP - need clarification of quotes in array names.

Jason Bauer jbauer at mtu.edu
Tue Feb 5 10:25:01 CST 2002


>How then do I echo $foo['bar'] as part of a string? if I have:
>         $foo['bar'] = "hello";
>         echo "$foo['bar'] world";

String Concatenation is the answer. You can use a period (.) to echo two
separate strings.

Also, I've always used double-quotes for associative arrays instead of single.

So, you should write:

echo $foo["bar"] . " world";



Jason Bauer
jbauer at mtu.edu
Michigan Tech Fund
Web Site Coordinator
http://www.mtf.mtu.edu/




More information about the thelist mailing list