- substr: documentation ( source)
- microtime: documentation ( source)
- str_shuffle: documentation ( source)
- number_format: documentation ( source)
- rand: documentation ( source)
- md5: documentation ( source)
<?php
$time = microtime(true);
$hash = 0;
for ($i = 0; $i < 1000000; $i += 1) {
// XOR
$hash ^= md5(substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), 0, rand(1,10)));
}
$time = microtime(true) - $time;
echo 'array_diff() took ' . number_format($time, 3) . ' seconds'.PHP_EOL;