|
Posted by Andy Jeffries on 04/13/06 23:05
On Thu, 13 Apr 2006 17:39:50 +0000, Carl Vondrick wrote:
>> print "</br>";
>>
> On the PHP side, the following is a little bit faster:
>
> echo '<br />';
While I don't dispute using echo instead of print and ' instead of " is
faster, has anyone actually done any benchmarks to see how much faster.
To be honest, I tend to use print (because I'm used to it) and "" (as I
generally would go back and add variables in later and may forget to
change the ' to ").
It's the same reason that in various coding standards it's recommended to
use {} even for single line ifs, so when the coder returns (or another one
edits the file) they're less likely to add a second indented line and not
see that the statement isn't wrapped in braces.
It's also faster to write functions inline, but at the expense of
readability/ease of maintenance. Not that we're comparing apples to
apples with that latter analogy (I know there's not much readability
difference in echo '' and print "").
Anyway, my point was - undeniably faster, but how much so... Anyone got
numbers?
Cheers,
Andy
--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos
[Back to original message]
|