PDA

View Full Version : sort an array in php


Billy T
07-07-2003, 07:22 AM
hey all

say I have an array that looks like

$ar[0]['page']='home';
$ar[0]['match']=9;
$ar[1]['page']='contact';
$ar[1]['match']=12;
$ar[2]['page']='blah';
$ar[2]['match']=8;

how would I sort this array so that the elements of $ar with the hightest match value get put at the start (and reindexed)

know what I mean?

so it should end up like

$ar[0]['page']='contact';
$ar[0]['match']=12;
$ar[1]['page']='home';
$ar[1]['match']=9;
$ar[2]['page']='blah';
$ar[2]['match']=8;

Thanks

Billy T
07-07-2003, 08:41 AM
nevermind

cheers