3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRandomStr($length){ return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); } $start = microtime(true); // Mixed could theoretically be an object or an array. // In this example it's an array. $mixed = array(); for($i = 0; $i < 100; $i++) { if (is_array($mixed)) { $mixed[getRandomStr(15)] = 'abcd'; } else { // Do something else which we don't care about here } } print round(microtime(true) - $start, 2) . 's';
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.3, 5.2.10, 5.2.12 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
0s
Output for 5.2.11
0.07s
Output for 5.2.9
0.05s
Output for 5.2.8
0.01s
Output for 5.2.6 - 5.2.7
0.04s
Output for 5.2.5
0.03s
Output for 5.2.4
0.02s

preferences:
210.5 ms | 401 KiB | 325 Q