moze Ci sie przyda..[php:1:0e40f0b7e4]<?
$dane = array
('0&1000&940&180',
'1&220&7800&2000',
'3&500&2880&750',
'0&700&935&140',
'2&500&940&160',
'0&1500&940&160',
'1&300&1440&150',
'3&380&740&1800',
'2&1000&935&140');
$n = count ($dane);
$tmp0 = array();
$tmp1 = array();
for ($i = 0; $i < $n; $i++)
{
$ex = explode("&",$dane[$i]);
$tmp0[$i] = $ex[0];
$tmp1[$i] = $ex[1];
}
$nmb = array ();
for ($i = 0; $i < $n; $i++)
{
$nmb[$i] = $i;
}
function cmp ($a, $
{
global $tmp0, $tmp1;
if ($tmp0[$a] != $tmp0[$b])
{
return $tmp0[$a] - $tmp0[$b];
}
else
{
return $tmp1[$a] - $tmp1[$b];
}
}
usort ($nmb, "cmp");
unset ($tmp0); // juz niepotrzebne
unset ($tmp1); // juz niepotrzebne
$temp = array();
for ($i = 0; $i < $n; $i++)
{
$temp[$i] = $dane[$nmb[$i]];
}
unset ($nmb); // juz niepotrzebne
$dane = $temp;
unset ($temp); // juz niepotrzebne
for ($i = 0; $i < $n; $i++)
{
echo ("$i:$dane[$i]<br>");
}
?>
?>[/php:1:0e40f0b7e4]
ps. kod nie mojego autorstwa..