Although the use of both Print and Echo are same, but it has been seen that people uses echo command more then the print command. But that’s completely a personal preference, you can use whatever you wanted to use.
We don’t see much difference between these two commands as both prints value on the web pages. But on comparing we can say that echo is bit faster then print command, as it does not return any value. On the other side Print command returns true or false (Boolean) value that takes some time to process.
Lets take an example of print and echo command:
<?phpprint "Hello <br />";
As you can see in the output both print & echo commands are printing the assigned value on the browser without any error. That means both the commands are correct and capable enough to print the value. So, it depends on you which command you wanted to use.
Posted on: October 27, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles