E
evachick156
Guest
Im having a bit of trouble. I do calculations from $tot1 - $tot9...and i have if statements checking which is the smallest value.
if($tot1 < $tot2)
{
$min = $tot1;
}
else
{
$min = $tot2;
}
if($min > $tot3)
{
$min = $tot3;
}
if($min > $tot4)
{
$min = $tot4;
}
if($min > $tot5)
{
$min = $tot5;
}
if($min > $tot6)
{
$min = $tot6;
}
if($min > $tot7)
{
$min = $tot7;
}
if($min > $tot8)
{
$min = $tot8;
}
if($min > $tot9)
{
$min = $tot9;
}
Now my problem is sometimes the $tot1 - $tot9 can contain 0 values, which I dont want the min to be. What is the best way to check for the smallest value and make sure the $tot1 - $tot9 does not contain 0 for checking the minimum?
if($tot1 < $tot2)
{
$min = $tot1;
}
else
{
$min = $tot2;
}
if($min > $tot3)
{
$min = $tot3;
}
if($min > $tot4)
{
$min = $tot4;
}
if($min > $tot5)
{
$min = $tot5;
}
if($min > $tot6)
{
$min = $tot6;
}
if($min > $tot7)
{
$min = $tot7;
}
if($min > $tot8)
{
$min = $tot8;
}
if($min > $tot9)
{
$min = $tot9;
}
Now my problem is sometimes the $tot1 - $tot9 can contain 0 values, which I dont want the min to be. What is the best way to check for the smallest value and make sure the $tot1 - $tot9 does not contain 0 for checking the minimum?