note 53925 added to function.echo
| From: | marcus at synchromedia dot co dot uk | Date: | Fri, 17 Jun 2005 08:33:02 +0000 |
| Subject: | note 53925 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90574@lists.php.net to get a copy of this message | ||
The benchmark notes from 2002 don't seem to be right any more. I did some loop tests for
different kinds of output formatting in PHP 5.0.4. The numbers are the time taken for 10000
iterations:
echo 'Key is ', $k, '<br>',"\n",'Value is ', $v,
'<br><br>', "\n";
0.97371506690979
echo 'Key is ', $k, "<br>\nValue is ", $v,
'<br><br>', "\n";
0.77851700782776
echo "Key is $k<br>\nValue is $v<br><br>\n";
0.51984405517578
echo 'Key is '. $k. '<br>'."\n".'Value is '. $v.
'<br><br>'. "\n";
0.37696409225464
It seems that concatenation is way faster than multiple parameters, and interpolation is pretty good
too.
----
Manual Page -- http://www.php.net/manual/en/function.echo.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53925
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53925&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53925&report=yes
Search -- http://master.php.net/manage/user-notes.php