Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,463 members, 7,781,341 topics. Date: Friday, 29 March 2024 at 12:41 PM

What's The Difference Between Php Echo() And Php Print()? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / What's The Difference Between Php Echo() And Php Print()? (1110 Views)

Difference Between Computer Science And Computer Engineering / Asp.net And Php Which Is Better / Difference Between A Programmer And A Web Developer? (2) (3) (4)

(1) (Reply) (Go Down)

What's The Difference Between Php Echo() And Php Print()? by mario2027(f): 3:32am On Dec 20, 2010
What's the difference between PHP echo() and PHP print(), especially in the execution time?
Re: What's The Difference Between Php Echo() And Php Print()? by mikkytrio(m): 5:31pm On Dec 20, 2010
echo
hello world
processing time for a hello world program = 0.030235052108765

print
hello world
processing time for a hello world program= 3.7908554077148E-5

printf
hello world
processing time for a hello world program= 3.504753112793E-5

i hope this answers your question
Re: What's The Difference Between Php Echo() And Php Print()? by Thatdave(m): 10:22pm On Dec 20, 2010
Bro
In all your php scripting forget "print" always use "echo"
With single or double quotes depending on the content of the echo.

In Php print is like homo erectus and echo is like homo sapiense
Bottom line
Never use print in your php life bc there is always an echo.

DaveozoalorATgmail.com
Preparing for my php exam in January.
Re: What's The Difference Between Php Echo() And Php Print()? by kanirip: 12:20am On Dec 21, 2010
It is not that straight-forward as to just say 'Use echo'.

Apparently( I say 'apparently' because I am yet to test this and as such can not say it authoritatively) echo is faster because it doesn't set a return value on execution but I think that there are other factors that you should take into consideration:

http://stackoverflow.com/questions/1006586/is-there-any-difference-between-print-and-echo-in-php-closed

It has some comments regarding the usefulness of the print statement and maybe you would want to look at that before deciding to use echo wink
Re: What's The Difference Between Php Echo() And Php Print()? by Nobody: 9:03am On Dec 21, 2010
I think in Output Buffering there's a difference
Re: What's The Difference Between Php Echo() And Php Print()? by joefazee(m): 4:29pm On Dec 21, 2010
I hardly use echo/print/printf due to template engine (smarty), my best friend is var_dump and print_r for debugging . but i think echo is faster. just develop your own coding standard.

(1) (Reply)

Abeg O,help Me With Dis VB.NET Code / Let Me Teach You How To Design A Website With Html. / SMART CODE : Android Barcode Creator & Scanner

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.