I have been trying to take an array i have, delete all the values that are "blank" sort it and then get the lowest number value.
atm it looks something like this...
<?
$visited = array(0=>"blank",1=>"12324324234",2=>"1234124342",3=>"2345234523452345",4=>"blank");
function array_delete($array, $filterfor){
$thisarray = array ();
foreach($array as $value)
if(stristr($value, $filterfor)===false && strlen($value)>0)
$thisarray[] = $value;
return $thisarray;
}
echo "visited is"; print_r($visited); echo "<br>";
$visited = array_delete($visited,"blank");
echo "visited after array_delete is"; print_r($visited); echo "<br>";
$visited = asort($visited);
echo "visited after asort is"; print_r($visited); echo "<br>";
$visited = current($visited);
$visited = time() - $visited ;
$average = count($visited) / $visited;
echo "Your time so far is $visited. Your average is 1 system every $average";
?>
$visited is just an array to simulate the actuall array thats created, but thats what it looks like... the trouble atm is, that after the 'asort' my array is turned into '1'.
this is what i get when i run this code:
visited isArray ( [0] => blank [1] => 12324324234 [2] => 1234124342 [3] => 2345234523452345 [4] => blank )
visited after array_delete isArray ( [0] => 12324324234 [1] => 1234124342 [2] => 2345234523452345 )
visited after asort is1
Warning: Variable passed to current() is not an array or object in /web/sites/223/claneod/www.clan-eod.co.uk/eve/TMPbqwjrnu2eq.php on line 21
$visited is an array to start with, is an array after haveing the "blanks" deleted, but is then a '1' after sorting it?? this is the same for any kind of sort.... i cant work out what the problem with it is?
I'm guessing i'm not useing the sort corectly?
ne1 with ne ideas??