note 65722 deleted from language.references by bjori
| From: | bjori@php.net | Date: | Sat, 06 May 2006 16:16:20 +0000 |
| Subject: | note 65722 deleted from language.references by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-110702@lists.php.net to get a copy of this message | ||
Note Submitter: wowa at ssu dot samara dot ru
Reason: in docs
----
PHP5
<?php
function test_1(&$arr) {
$size = sizeof($arr);
// for($n=0; $n<$size; $n++) { $x = 1; }
}
function test_2(&$arr) {
$size = sizeof(&$arr);
// for($n=0; $n<$size; $n++) { $x = 1; }
}
function test_3($arr) {
$size = sizeof(&$arr);
// for($n=0; $n<$size; $n++) { $x = 1; }
}
function test_4($arr) {
$size = sizeof($arr);
// for($n=0; $n<$size; $n++) { $x = 1; }
}
// fill array
for($n=0; $n<20000; $n++) {
$ar[] = "test".$n;
}
$time = microtime();
test_1($ar);
echo "1: ".(microtime() - $time)." s\n";
$time = microtime();
test_2($ar);
echo "2: ".(microtime() - $time)." s\n";
$time = microtime();
test_3($ar);
echo "3: ".(microtime() - $time)." s\n";
$time = microtime();
test_4($ar);
echo "4: ".(microtime() - $time)." s\n";
?>
print:
1: 0.014593 s
2: 1.69999999999E-005 s
3: 0.016748 s
4: 2.1E-005 s