I have never been good at using loops. I have the following problem:
When I execute the code below, I get this error message: "Parse error: syntax error, unexpected T_VARIABLE in XXXXXXXXX on line 8"
. I just want to give each of the elements in the array a "rating" on how high the value is.
<?
$input = array( 12413535, 13452465246, -13451, 8);
$input_size = count($input);
$var_rating = array ();
foreach ($input as $value) {
$var_rating[$value] = 0;
foreach ($input as $test) {
if ($value > $test) {
$var_rating[$value] = $var_rating[$value] + 1;
}
else {}
}
}
var_dump($var_rating);
?>
Sorry for the confusion. I edited my question and added the full code.