<?php
namespace Any;
$value = array(
);
for ($i=0;$i<1e10;$i++) {
$value[] = $i;
}
$start = microtime(true);
$values = array_map(function($item){ return $item+1;}, $value);
$end = microtime(true);
echo "Simple func took: ", number_format(($end-$start)*1e3, 2), PHP_EOL;
$start = microtime(true);
$values = \array_map(function($item){ return $item+1;}, $value);
$end = microtime(true);
echo "Direct func took: ", number_format(($end-$start)*1e3, 2);
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 7.2.33, 7.3.16 - 7.3.30, 7.4.0 - 7.4.24, 8.0.0 - 8.0.11
- Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 67108872 bytes) in /in/JWXnC on line 9
Process exited with code 255.
preferences:
93.52 ms | 402 KiB | 87 Q