Skip to content

Instantly share code, notes, and snippets.

@bxt
Created February 27, 2011 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bxt/846188 to your computer and use it in GitHub Desktop.
Save bxt/846188 to your computer and use it in GitHub Desktop.
Examining echo String concat in PHP: echo a,b,c; vs. echo a.b.c;
function foo (){
echo "in \n";
return "bar \n";
}
echo "\nComma:\n";
echo foo (),foo (),foo ();
echo "\nDot:\n";
echo foo ().foo ().foo ();
echo "\n";
/*
Result: . concat will execute all first, while m, will execute between outputs
Output:
Comma:
in
bar
in
bar
in
bar
Dot:
in
in
in
bar
bar
bar
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment