I can't figure it out where I have done the mistake. Simply, I want to print the value of $i variable in the for loop.
But it doesnt print anything. To ensure $fms, $tecsol and etc variables are printed and they have the values.Please see below.
0.6
1.8
2.7
2.5
2.5
2
0.5
3
Here is the code for for loop.
function sortCatergory(){
//assigning return values to variable , return value is an average which is =< 5
echo $econ=func_Economics();
echo '</br>';
echo $fms=func_FMS();echo '</br>';
echo $tecsol=func_Technology_Solutions();echo '</br>';
echo $math=func_Mathematics();echo '</br>';
echo $stat=func_Statistics();echo '</br>';
echo $quant=func_Quant_Equity();echo '</br>';
echo $gensoft=func_General_Software_Programming();echo '</br>';
echo $dataprod=func_Data_Products();echo '</br>';
for($i=5; $i>0.1; $i=$i-.1){
//echo $i.'</br>';
if($econ==$i){
echo $i.'</br>';
}
if($fms==$i){
echo $i.'</br>';
}
if($tecsol==$i){
echo $i.'</br>';
}
if($math==$i){
echo $i.'</br>';
}
if($stat==$i){
echo $i.'</br>';
}
if($quant==$i){
echo $i.'</br>';
}
if($gensoft==$i){
echo $i.'</br>';
}
if($dataprod==$i){
echo $i.'</br>';
}
}
}
Here for echo $i.'<br>' print nothing. But I expect to print same result again when they are equal.
Where I have done wrong?
$stat,$quant) etc are calculated, you might be experiencing floating-point precision problems.ifs to a singleifstatement usingOR(||) operator to increase readability.