echo is slightly faster than print and it takes multiple arguments so
instead of:
echo '<p>' . $test . '</p>';
you can do
echo '<p>' , $test , '</p>';
which should be faster, and I say 'should' just because as print should be
slower because it has to go into the trouble of setting up a return value,
so avoiding doing a concatenation first and then output the whole thing by
just streaming each of the pieces to the output straight away should be
faster, though string operations are so optimized as to be neglig....
well, you can't tell the difference.
Satyam
----- Original Message -----
From: "Danial Rahmanzadeh" <danrah@xxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, February 13, 2007 4:49 PM
Subject: print() or echo
is it true that echo is a bit faster than print()? in general, when we
don't
need a return value, which one is better to choose?
Cheers,
Danial Rahmanzadeh
--------------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.17.37/682 - Release Date: 12/02/2007
13:23
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php