Soldato
- Joined
- 30 Nov 2005
- Posts
- 3,084
- Location
- London
Trying to sort the first value ($val[0]), whilst keeping the second ($val[2]) in the right order along side it, using rsort (highest to lowest), but it just won't work. It seems to be ordering them in a group, for example I have put 3, 4, 300, 200 and 100 in as test values.
It displays them in this order: 4 - 3 - 300 - 200 - 100 using rsort.
Any ideas?
It displays them in this order: 4 - 3 - 300 - 200 - 100 using rsort.
Any ideas?
PHP:
$arr = file("test.txt");
rsort($arr);
foreach($arr as & $val)
{
$val = explode("||", $val);
}
unset($val);
echo '<table>';
$count = 0;
foreach ($arr as $val)
{
echo '<tr><td class="init"><strong>N:</strong> </td><td>'.$val[2].'</td>';
echo '<td class="ssc"> <strong>S:</strong> </td><td>'.$val[0].'</td>';
echo '<tr><td colspan="2"> </td></tr>';
$count++;
if ($count == 5) break;
}
echo '</table>';