Re: echo VS print : that's a cool behavior !

From: Date: Tue, 23 Oct 2007 16:48:43 +0000
Subject: Re: echo VS print : that's a cool behavior !
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-263557@lists.php.net to get a copy of this message
On 10/23/07, Robert Cummings <robert@interjinn.com> wrote: > My bad, print is not a function, and so: > > print( 'toctoc ' ).'hihi '; > > is equivalent to: > > print( 'tocktoc '.'hihi ' ); > Ah. I see. I knew they were optional, but I didn't know that when you include them PHP evaluates ('toctoc') before it passes the value off to print(). I just figured that with or without the parentheses it would pass 'toctoc' to print() and return a result that would be concatenated inline with the other values. I guess that's the part I didn't understand about the difference between a function and a language construct in PHP. As for the OP, I still don't know why anyone would even dream of creating code that does this other than "to see what would happen if we ...." :-) Andrew

« previous php.general (#263557) next »