I am trying to find lowest of odd numbers in an array.
Here is my code:
$a=array(81,10,6,71,13,61,8,16,0,9,12);
$b=count($a);
for($i=0;$i<$b;$i++)
{
if($a[$i]/2!=0)
{
$flag=0;
for($j=0;$j<$b;$j++)
{
if($a[$j]<=$a[$i] and $a[$j]/2!=0)
{
$a[$i]=$a[$j];
$flag=1;
}
}
if($flag==1)
{
echo('lowest odd number is'.$a[$i]);
}
break;
}
break;
}
I am not looking for new logic I am just trying to find an error in the above code. Why is it not working?