Echo and print in PHP
As mentioned before, this site is powered by PHP (version 5
at the moment) and it is powered by
Output in PHP
Both echo and print serve similar purposes. Both of these statements are designed to output HTML to the page.
For instance, some pages are updated through a seperate file
and refreshed using AJAX. The
Data being passed around this way makes for dynamic content which can be processed by the server.
<?php //This is an example of print print '<p>Hello world!</p>'; ?>
echo function is considered faster than
echo function cannot have a variable bound to
it. This is an advantage of
echo over print, unless it is
required to bind some variable to the return value of
that returns whether or not the
<?php //This is an example of echo echo 'Hello there world!'; ?>