I actually prefer the concatenated way since it makes more sense to me and helps me understand whats going on in the string better. Also the syntax coloring in my editor (BBEdit) will differentiate the vars if they are concatenated, otherwise they blend in with the string and I need to look harder to find things.
As for the type of coding I do, just getting my feet in the water so nothing too complex. I used to code a bit but have not done anything other than modify existing code for a few years so I am a very rusty, not that I was very advanced before anyway. I can’t understand classes for beans, which has me worried (the old dog new trick thing). Anyway I am exited to be getting back into it and am getting that rush of power you get once you start seeing results emerge from the code. The ironic thing is that I am getting back into coding as a result of a CMS, normally a CMS will keep you away from the code rather than inviting you to dig in. Thats one of the cool things about MODx, well for me at least.
Would be cool to have a dedicated php sub-forum, I feel that it could end up being a good resource.
If I have a complicated string to put together, I usually do it with the .= operator. Then when I get it the way I want it I contatenate it.
$output = "";
$output .='<a href='
$output .='"http://url.com">';
$output .='Link</a>';
(not the greatest example, but you get what I mean).
Another trick, when you’re using echo is that echo will accept multiple arguments which sometimes makes it easier when you have a mixture of things to print and (I once read) speeds things up a little since there’s only one call to echo.
echo "print this: ",$var1,", then print this: ",$var2,", then finish up with this.";
Bob
yup..
echo "\n" will print out a new line whereas
echo ’\n’ will print out a string \n