Reecriture complete de testbw() -> Pre-Test en 128Ko (seul test pour les petits debits) -> Second Pre-Test avec 128Ko a 512Ko -> puis test avec 512Ko a 4096Ko selon la bande passante -> Conversion et affichage en Ko/sec Ce programme est sous licence GNU GPL, v2.0 ou ulterieure http://www.gnu.org/copyleft/gpl.html (C) 2001, Gilles Lacarriere http://speedtest.nomai.com ************************************************************************ */ function array_sort($array, $key) { for ($i = 0; $i < sizeof($array); $i++) { $sort_values[$i] = $array[$i][$key]; } asort ($sort_values); reset ($sort_values); while (list ($arr_key, $arr_val) = each ($sort_values)) { $sorted_arr[] = $array[$arr_key]; } return $sorted_arr; } function array_max($array, $key) { for ($i = 0; $i < sizeof($array); $i++) { $sort_values[] = $array[$i][$key]; } return max($sort_values); } function testbw($multiplier, $koofdata) { $t1=microtime(); for ($s=1; $s<=$multiplier; $s++) { echo ""; } $t2=microtime(); $t1=((double)strstr($t1, ' ')+(double)substr($t1,0,strpos($t1,' '))); $t2=((double)strstr($t2, ' ')+(double)substr($t2,0,strpos($t2,' '))); $kbps = $koofdata*8*$multiplier/($t2 - $t1); return(str_pad(round($kbps, 3),5, "0", STR_PAD_RIGHT)); } function displayTestResult() { $results = testbw(1,128); if ($results > 3072) $results = testbw(4,128); elseif ($results > 1536) $results = testbw(3,128); elseif ($results > 768) $results = testbw(2,128); elseif ($results > 384) $results = testbw(1,128); if ($results > 3072) $results = testbw(4,512); elseif ($results > 1536) $results = testbw(3,512); elseif ($results > 768) $results = testbw(2,512); elseif ($results > 384) $results = testbw(1,512); elseif ($results > 128) $results = testbw(1,128); echo "\n
Your Speed : ".$results." kbps
\n"; } ?>