Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function foo(&$p) {
- for($i=0; $i<count($p); $i++) {
- // Do nothing
- }
- }
- function foo2(&$p) {
- $count = count($p);
- for($i=0; $i<$count; $i++) {
- // Do nothing
- }
- }
- $array = array();
- for($i=0; $i<5000; $i++) {
- $array[$i]=$i;
- }
- $t=microtime(true);
- foo($array);
- echo "Foo: " . (microtime(true)-$t) ."\n";
- $t=microtime(true);
- foo2($array);
- echo "Foo2: " . (microtime(true)-$t) ."\n";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment