Created
February 27, 2011 13:36
-
-
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;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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