Code: Select all
echo $foo.$barCode: Select all
echo $foo,$barFirstly is this one...
Code: Select all
class A {
public function __toString() {
return 'A';
}
}
$foo = new A();
// __toString not called with dot
echo '123 '.$foo; // outputs "123 Object id #1"
echo "\n";
// __toString called using commas
echo '123 ',$foo; // outputs "123 A";And then there is this one...
Code: Select all
$a = 'cerial';
$b = 'milk';
$c = 'occasionally';
$msg = 'I '. $c .' eat '. $a .' with'. $b; // I occasionally eat cerial with milk
$msg = 'I ', $c ,' eat ', $a ,' with', $b; // Parse error: syntax error, unexpected ','
// to make the line above work i'd need to change all those commas to dotsThing is I have a sneeky feeling that the comma is faster than the dot operator for output. Not being a Zend Engine programmer I can only spectulate but I have a feeling that this...
Code: Select all
echo $foo,$bar,$zim;Code: Select all
echo $foo;
echo $bar;
echo $zim;Code: Select all
echo $foo.$bar.$zim;Code: Select all
$tmp = $foo.$bar.$zim; // involves processing
echo $tmp;Of course this is only a theory. I'm interested to know if I am correct.