<?php $rand = []; $max = 10000; $keys=array(); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; $keys[] = $i; } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $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.