Re: PHP Trick or Not - You Be the Judge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brandon Rampersad wrote:
> Hello guys, i was just doing some testing and was wondring if echo is faster
> than print or print_r. I think since echo is a language construct and
> print_r is a function, echo is faster.
> 
> Please let me know.
> 
> Thanks
> 

People in the past have said that echo and print as actually the same call
within PHP core system.  I have never dug through the core code that makes up
PHP so I cannot confirm this claim.

print_r on the other hand is a totally different thing.  It takes and processes
strings, arrays, objects, etc... So, with that said, it will be much slower.  It
has to detect what type of object it is and then deal with all the pieces.  And
then in the end, output everything to the screen.

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux