Difference in print and echo?
Posted: Wed Apr 02, 2003 2:44 pm
I've noticed in a lot of code people tend to use "print" for html, and "echo" for php.
so... in like....
index.php
<?
$hello = "Hello world";
print ("<table><tr><td>");
echo $hello;
print ("</td></td></table>");
?>
I was wondering if there was any logical reason for this.
A friend gave his opinon:
Print just prints, bypasses memory.
Echo goes through memory before it prints to the screen.
So according to him, echoing a var would be faster(slightly) than printing the var.
And printing html would be faster(slightly) than echoing html.
I don't know if hes right or not, so I thought I'd post the question here.
--pb
so... in like....
index.php
<?
$hello = "Hello world";
print ("<table><tr><td>");
echo $hello;
print ("</td></td></table>");
?>
I was wondering if there was any logical reason for this.
A friend gave his opinon:
Print just prints, bypasses memory.
Echo goes through memory before it prints to the screen.
So according to him, echoing a var would be faster(slightly) than printing the var.
And printing html would be faster(slightly) than echoing html.
I don't know if hes right or not, so I thought I'd post the question here.
--pb