₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,084 members, 8,420,238 topics. Date: Thursday, 04 June 2026 at 02:20 PM

Toggle theme

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

Nairaland ForumScience/TechnologyProgrammingWhat's The Difference Between Php Echo() And Php Print()? (1249 Views)

1 Reply (Go Down)

What's The Difference Between Php Echo() And Php Print()? by mario2027(op): 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

Difference Between Computer Science And Computer EngineeringAsp.net And Php Which Is BetterDifference Between A Programmer And A Web Developer?234

Programming AspirantTime To Scrap My Vb.net Skill?VB Programers In The House - Is This "Do-able"