@ 2017-08-12T17:43:55Z <?php
$array = array_fill(0, 100, uniqid('', false));
$array2 = $array;
$timer = microtime(true);
for ($i = 0; $i < 10; $i++) {
while (list($key, $value) = each($array)) {
$array[$key] = 'value';
}
}
printf("While list each %.3f sec\n", microtime(true) - $timer);
$timer = microtime(true);
for ($i = 0; $i < 10; $i++) {
foreach ($array2 as $key => &$value) {
$value = 'value';
}
}
printf("Foreach %.3f sec\n", microtime(true) - $timer);
var_dump(count($array), count($array2));
var_dump($array === $array2);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 7.2.0 - 7.2.24 , 7.3.0 - 7.3.12 Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/Ohr76 on line 7
While list each 0.000 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.0 - 7.0.1 , 7.0.3 - 7.0.4 , 7.0.7 - 7.0.8 , 7.1.2 , 7.1.6 - 7.1.7 , 7.1.25 - 7.1.33 While list each 0.000 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.2 , 7.1.8 While list each 0.010 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.1.5 While list each 0.009 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.1.4 While list each 0.022 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.1.3 While list each 0.011 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.13 , 7.1.1 While list each 0.003 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.11 , 7.1.0 While list each 0.002 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.9 - 7.0.10 , 7.0.15 , 7.0.19 - 7.0.20 While list each 0.005 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.6 , 7.0.18 While list each 0.008 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.17 While list each 0.014 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.14 , 7.0.16 While list each 0.004 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.12 While list each 0.006 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
Output for 7.0.5 While list each 0.018 sec
Foreach 0.000 sec
int(100)
int(100)
bool(true)
preferences:dark mode live preview ace vim emacs key bindings
61.56 ms | 423 KiB | 5 Q