|
Posted by Berimor on 12/04/05 17:34
Hi,
i've been always used the in_array() function to check availabylity of a
value in array. Until today. Simple code: (do not run it tho :) )
<?
function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
$first=range("a","z");
$second=range("a","z");
$third=range("a","z");
$all_arr=array();
foreach ($first as $f){
foreach ($second as $s){
foreach ($third as $t){
$ind=$f.$s.$t;
if (!in_array($ind,$all_arr)) $all_arr[]=$ind;
}
}
}
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo $time;
?>
It prints the time script worked. Guess the number?
250(!!!!) seconds!!!
Is there any alternative in PHP to check array?
--
Exact Meta Search | Major Search Engine http://exactsearcher.com
Web Design Essex | Multimedia | Printing http://nextwave.co.uk
Navigation:
[Reply to this message]
|