3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getRandomStr($length){ return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length); } $start = microtime(true); function put(&$mixed, $key, $value) { if (is_array($mixed)) { $mixed[$key] = $value; } else { // Do something else which we don't care about here } } $mixed = array(); for($i = 0; $i < 10000; $i++) { put($mixed, getRandomStr(15), 'abcd'); } print round(microtime(true) - $start, 2) . 's';

preferences:
31.98 ms | 402 KiB | 5 Q