- microtime: documentation ( source)
- hash: documentation ( source)
<?php
$string = 'jsdfldfcdfädädsa3e4fkdfd.dsfm jkdfdfdsafa-sad dkskdjsajdksafjflkfasd642fd#43rcdklanjrkesajsad';
$time0 = microtime(true);
for ($i = 0; $i < 10000; $i++) {
$sha512 = hash('sha512', $string);
}
$time1 = microtime(true);
for ($i = 0; $i < 10000; $i++) {
$md5 = hash('md5', $string);
}
$time2 = microtime(true);
echo 'sha512 mit ' . strlen($sha512) . ' braucht ' . $time1-$time0 . PHP_EOL;
echo 'md5 mit ' . strlen($md5) . ' braucht ' . $time2-$time1 . PHP_EOL;