$variable inside quotes
Which of the following is the proper syntax for the latest version of PHP?
echo "My name is $name. How are you?";
echo "My name is " . $name . ". How are you?";
cscgal
The Queen of DaniWeb
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
I'm not 100% Sure that one form is "more proper" than the other. I do realize that one form is more readable.... but I don't know if one is better syntax than the other?
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Comatose
Taboo Programmer
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
Often, arrays will work without any quotes at all ... $myarray[foo]. This is probably a long shot, but can you use double quotes for an array row by escaping them? i.e. $myarray[\"foo\"] ?? I doubt that ;)
cscgal
The Queen of DaniWeb
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229