3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $md5=md5(''); for($i=0;$i<10000;$i++){ $t=microtime(true);preg_match("#$md5#i",'ff'); $b[]=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));
Output for 5.3.0 - 5.4.24
Parse error: syntax error, unexpected ':' in /in/EkrXu on line 8
Process exited with code 255.