'0', 2 => 'a', 3 => 'f', 4 => 'G', 5 => "\n", 6 => ' ' ); for ( $i=1; $i<=count($tab); $i++ ) { echo NL. 'Serie '.$i . NL; $str = $tab[$i]; test1($str); echo NL; test2($str); echo NL; test3($str); echo NL; test4($str); echo NL; } function test1($str) { echo 't1.0 (',$str,'): '; $start=microtime(); for ($i=0; $i<5000; $i++) { if ( strstr(HEXA_SHORT,strtolower($str)) === FALSE ) { } } $end = microtime(); echoTime($start,$end); echo NL.'t1.1 (',$str,'): '; $start=microtime(); for ($i=0; $i<5000; $i++) { if ( strstr(HEXA_LONG,$str) === FALSE ) { } } $end = microtime(); echoTime($start,$end); } function test2($str) { echo 't2.1 (',$str,'): '; $start=microtime(); for ($i=0; $i<5000; $i++) { if ( !preg_match("/[a-fA-F0-9]/", $str)) { } } $end=microtime(); echoTime($start,$end); echo NL.'t2.2 (',$str,'): '; $start=microtime(); for ($i=0; $i<5000; $i++) { if ( !preg_match("/[a-f0-9]/i", $str)) { } } $end=microtime(); echoTime($start,$end); } function test3($str) { echo 't3.0 (',$str,'): '; $char = array(); for ($i = 0; $i<255; $i++) { $char[chr($i)] = 0; } $hexa_long = HEXA_LONG; for ($i=0; $i= 48 && $val <= 57) continue; if ($val >= 65 && $val <= 70) continue; if ($val >= 97 && $val <= 102) continue; } $end = microtime(); echoTime($start,$end); } function echoTime($start, $end) { $s = explode(' ', $start); $e = explode(' ', $end); echo (($e[0]+$e[1])-($s[0]+$s[1])); } ?>