note 68743 added to function.echo
| From: | sunstorm1000 at hotmail dot com | Date: | Wed, 09 Aug 2006 02:27:29 +0000 |
| Subject: | note 68743 added to function.echo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115713@lists.php.net to get a copy of this message | ||
To determine which method is best for outputting HTML, I ran a simple benchmark that tests the
following snippets:
<?
for ( $i = 0; $i < 10000; $i++ )
echo 'This is some test data that will be output via the script.';
?>
<?
$output = '';
for ( $i = 0; $i < 10000; $i++ )
$output .= 'This is some test data that will be output via the script.';
echo $output;
?>
<?
for ( $i = 0; $i < 10000; $i++ )
{
?>This is some test data that will be output via the script.<?
}
?>
My results are as such:
echo, one by one: 0.00934410095215
echo, concat: 0.02032995224
open/close php: 0.00726199150085
Hope this saves someone the trouble of doing the same.
----
Server IP: 81.92.200.26
Probable Submitter: 87.196.242.66
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.echo.php
Edit -- https://master.php.net/note/edit/68743
Del: integrated -- https://master.php.net/note/delete/68743/integrated
Del: useless -- https://master.php.net/note/delete/68743/useless
Del: bad code -- https://master.php.net/note/delete/68743/bad+code
Del: spam -- https://master.php.net/note/delete/68743/spam
Del: non-english -- https://master.php.net/note/delete/68743/non-english
Del: in docs -- https://master.php.net/note/delete/68743/in+docs
Del: other reasons-- https://master.php.net/note/delete/68743
Reject -- https://master.php.net/note/reject/68743
Search -- https://master.php.net/manage/user-notes.php