You are here: Re: Echo vs Print « PHP Programming Language « IT news, forums, messages
Re: Echo vs Print

Posted by Jamie Meyers on 06/02/05 02:28

> So - why does one choose "echo" over "print", or vice-versa?

Here is a closer to real answer and explanation why the two calls are
different. As you know, PHP has functions, however some methods (read:
functions) which do not return anything. This is the essential different
between echo and print. In visual basic, it is the difference between a sub
and a function.

Print returns its success as a boolean. Echo on the other hand does not
return anything. This return call is the only difference I can think of off
hand. As for speed, returning a value does cost some cpu time but it is
usually a negligible amount. With that said, use whatever you feel like.
Personally, I use echo because it is faster, and I never check for any
return values on print statements. If you need to, say for important
information, then print should be used.

I hope this clears things up a bit.
Jamie

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация