<?php $rand = []; $max = 10000; for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; } $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $keys = []; foreach ($rand as $k => $v) { $keys[] = $k; } } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $keys = array_keys($rand); } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max);
You have javascript disabled. You will not be able to edit any code.