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 < 1000; $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.17, 5.3.0 - 5.3.3, 5.3.5 - 5.3.6, 5.3.9 - 5.3.11, 5.3.14 - 5.3.20, 5.3.22, 5.3.26 - 5.3.29, 5.4.0 - 5.4.18, 5.4.20 - 5.4.21, 5.4.23 - 5.4.30, 5.4.32 - 5.4.33, 5.4.35 - 5.4.43, 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.8, 5.6.10 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
0s
Output for 5.3.4, 5.3.7 - 5.3.8, 5.3.12 - 5.3.13, 5.3.21, 5.3.23 - 5.3.25, 5.4.19, 5.4.22, 5.4.31, 5.4.34, 5.4.44, 5.6.9
0.01s

preferences:
207.76 ms | 403 KiB | 322 Q