[ create a new paste ] login | about

Link: http://codepad.org/xvJd3Jlq    [ raw code | output | fork | 1 comment ]

PHP, pasted on Feb 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$t = microtime(true);
for($i=0;$i<100;$i++) {
    echo '.';
}
$t1 = microtime(true)-$t;

$t = microtime(true);
for($i=0;$i<100;$i++): ?>.<?php endfor;
$t2 = microtime(true)-$t;

echo PHP_EOL;
echo 'Within PHP:  ', $t1, PHP_EOL;
echo 'Outside PHP: ', $t2, PHP_EOL;
echo 'The fastest is ', $t1 > $t2 ? 'Outside PHP' : 'Within PHP';


Output:
1
2
3
4
........................................................................................................................................................................................................
Within PHP:  0.027460098266602
Outside PHP: 0.0068960189819336
The fastest is Outside PHP


Create a new paste based on this one


Comments:
posted by Ne0 on Nov 16
wow!!!
today I learned something new :)
reply