3v4l.org

run code in 300+ PHP versions simultaneously
<?php $md5=md5(''); for($i=0;$i<10000;$i++){ $t=microtime(true);preg_match("#$md5#i",'ff'); $a[]=microtime(true)-$t; } // Remove the first and last iterations array_shift($a); array_pop($a); // Print the average cost of each function call printf("Average preg_match on md5() = %.6f seconds\n",array_sum($a)/count($a)); for($i=0;$i<10000;$i++){ $t=microtime(true); filter_var('0x'.$md5,FILTER_VALIDATE_INT,FILTER_FLAG_ALLOW_HEX); $b[]=microtime(true)-$t; } // Remove the first and last iterations array_shift($b); array_pop($b); // Print the average cost of each function call printf("Average filter_var on md5() = %.6f seconds\n",array_sum($b)/count($b));

preferences:
33.42 ms | 402 KiB | 5 Q