[thelist] php form

Dougal Campbell dougal at gunters.org
Fri Nov 22 14:19:01 CST 2002


On Fri, 22 Nov 2002, MarsHall wrote:

> On Friday, Nov 22, 2002, at 11:04 US/Central, MarsHall wrote:
> > In fact, there currently is NO DIFFERENCE between print() and echo().
>
> I lied ;)

I already replied to your other message before I saw that one, but what
the hey....

> In the nitty-gritty details, print() can act like a function, because
> it will set a return value. So, this works:
>
> 	$foo = print "Hello World!";
>
> while doing the same with echo():
>
> 	$foo = echo "Hello World!";
>
> would NOT set $foo.
>
> Although, to me they are synonyms! I can't imagine where I would use
> that function-like behaviour of print().

Well, I mentioned that example previously:
  ($some_var) ? print('true'): print('false'); // print is a function

However, I'd probably never do that in my code. I'd more likely do
something like:

  print (($some_var) ? 'true' : 'false');

The docs say that print returns FALSE on failure. But what kind of
failure are they talking about? Even if printing the value of an unset
variable, it returns true....

--
Ernest MacDougal Campbell III, MCP+I, MCSE <dougal at gunters.org>
http://dougal.gunters.org/             http://spam.gunters.org/
  Web Design & Development:  http://www.mentalcollective.com/
       This message is guaranteed to be 100% eror frea!




More information about the thelist mailing list