3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rand = []; $max = 10000; $keys=array(); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; $keys[] = $i; } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; } $keys = array_keys($rand); printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max);
Output for 8.2.19
Took 0.0000008 seconds per execution Took 0.0000007 seconds per execution
Output for 8.2.18
Took 0.0000016 seconds per execution Took 0.0000017 seconds per execution
Output for 8.1.1
Took 0.0000025 seconds per execution Took 0.0000019 seconds per execution
Output for 7.3.14, 7.3.23, 7.4.0, 7.4.3 - 7.4.4, 7.4.6, 7.4.10 - 7.4.11, 7.4.13, 7.4.18, 7.4.23, 8.0.2, 8.0.9, 8.1.0
Took 0.0000019 seconds per execution Took 0.0000019 seconds per execution
Output for 7.3.13, 7.3.17, 7.3.21 - 7.3.22, 7.3.24 - 7.3.25, 7.3.27 - 7.3.28, 7.3.32, 7.4.1, 7.4.5, 7.4.8, 7.4.12, 7.4.15 - 7.4.16, 7.4.20 - 7.4.22, 7.4.26, 8.0.0 - 8.0.1, 8.0.5, 8.0.7 - 8.0.8, 8.0.11 - 8.0.14
Took 0.0000017 seconds per execution Took 0.0000017 seconds per execution
Output for 7.3.15, 7.3.26, 7.3.31, 7.3.33, 7.4.14, 7.4.27, 8.0.10
Took 0.0000018 seconds per execution Took 0.0000017 seconds per execution
Output for 8.0.6
Took 0.0000017 seconds per execution Took 0.0000019 seconds per execution
Output for 7.3.16, 7.3.18, 7.3.20, 7.3.30, 7.4.19, 8.0.3
Took 0.0000017 seconds per execution Took 0.0000018 seconds per execution
Output for 7.4.25
Took 0.0000020 seconds per execution Took 0.0000017 seconds per execution
Output for 7.4.24
Took 0.0000020 seconds per execution Took 0.0000021 seconds per execution
Output for 7.4.9
Took 0.0000024 seconds per execution Took 0.0000019 seconds per execution
Output for 7.4.7
Took 0.0000021 seconds per execution Took 0.0000019 seconds per execution
Output for 7.4.2
Took 0.0000019 seconds per execution Took 0.0000017 seconds per execution
Output for 7.3.29
Took 0.0000019 seconds per execution Took 0.0000018 seconds per execution
Output for 7.3.19
Took 0.0000042 seconds per execution Took 0.0000019 seconds per execution

preferences:
69.89 ms | 425 KiB | 5 Q