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';

preferences:
28.06 ms | 402 KiB | 5 Q