PHP
59
test jpg
Guest on 20th June 2022 04:53:19 PM
<?php
header('Content-type: text/plain');
1 => 'jesuisTRToidaiosjj..d=09qwidek-320ik asdas a a d sad aas ds asd.jpg',
2 => 'filehuit.jpg',
3 => ' .dasd asdasdjask.jpgdkalsjd askldj aslkjd ajksdjaskld jaslk djaskl'
);
for ( $i=1; $i<=3; $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;
test5($str); echo NL;
test6($str); echo NL;
test7($str); echo NL;
}
function test1($str) {
echo 't1: ';
for ($i=0; $i<5000; $i++) {
if ( preg_match("/.+\.jpg$/i", $str) !== FALSE ) {}
}
echoTime($start,$end);
}
function test2($str) {
echo 't2: ';
for ($i=0; $i<5000; $i++) {
}
echoTime($start,$end);
}
function test3($str) {
echo 't3: ';
for ($i=0; $i<5000; $i++) {
}
echoTime($start,$end);
}
function test4($str) {
echo 't4: ';
# bugge.. retourne faux test.jpg.jpg
for ($i=0; $i<5000; $i++) {
}
echoTime($start,$end);
}
function test5($str) {
echo 't5: ';
/*
$start=microtime();
for ($i=0; $i<5000; $i++) {
if (eregi ('^.jpg$', substr ($str, strlen($str) - 4, 4))) {}
}
$end=microtime();
*/
echoTime($start,$end);
}
function test6($str) {
echo 't6: ';
for ($i=0; $i<5000; $i++) {
}
echoTime($start,$end);
}
function test7($str) {
echo 't7: ';
for ($i=0; $i<5000; $i++) {
if ($long>4)
if ($str{($long-4)} == '.')
}
echoTime($start,$end);
}
function echoTime($start, $end) {
echo (($e[0]+$e[1])-($s[0]+$s[1]));
}
?>