I am sure there is a simpler solution to this that I am over looking
Here is some code that basically describes what I am doing:
$array = array('1.4','2.7','4.1','5.9');
$score = '4.4';
foreach($array as $value) {
if($score>$value){
$x = $value;
}
}
foreach($array as $value) {
if($x==$value){
echo $value."<br>";
echo $score."<-- <br>";
} else {
echo $value."<br>";
}
}
Will display as:
1.4
2.7
4.1
4.4<--
5.9
What I am trying to do is print the array values with the score value in order.
Why don’t you change the array to actual numerical values and then sort it?
Or if you need to work with strings: