> > echo "bar is $bar"; > > vs. > > echo 'bar is '.$bar; > > > > additionaly in the first version $bar will be automagically transformed > > into a string, which is not nessecary. > > In the second version, you used the . operator, which also > automagically transforms $bar into a string for that operation, > there is no difference between the two in this aspect, echo > needs string[s] to print out. :) We'll see what others think...
+1 for not worrying about strings this way, either is okay. If I were to pick one (which is imho a bad idea) it be using "". But, this is not always the case, depends. Now, I believe the bulk of Jan's comment was regarding arrays here, which was: 'string '. $arr['key'] .' blah'; And I believe Goba desires: "string {$arr['key']} blah" And I'm more or less for: "string $arr[key] blah" As it's most readable. But the only problem is outside of strings this creates E_NOTICE as constant 'key' is looked for first and not found, this may confuse some who don't read the foo[bar] part in manual :) But, {} syntax here is php4 specific although not a major deal. *shrugs* Regards, Philip Olson