Jump to content

Array_mutlisort


karthikanov24
 Share

Recommended Posts

hiThe following code,

<?php$a=array(0=>array('cat_id'=>17,'cat_parentid'=>10,'cat_name'=>'mercedes'),1=>array('cat_id'=>12,'cat_parentid'=>14,'cat_name'=>'volvo'),2=>array('cat_id'=>16,'cat_parentid'=>11,'cat_name'=>'zen'));print_r($a);echo "<hr>";array_multisort($a);print_r($a);?>

gives the out put as follow:Array ( [0] => Array ( [cat_id] => 17 [cat_parentid] => 10 [cat_name] => mercedes ) [1] => Array ( [cat_id] => 12 [cat_parentid] => 14 [cat_name] => volvo ) [2] => Array ( [cat_id] => 16 [cat_parentid] => 11 [cat_name] => zen ) ) --------------------------------------------------------------------------------Array ( [0] => Array ( [cat_id] => 12 [cat_parentid] => 14 [cat_name] => volvo ) [1] => Array ( [cat_id] => 16 [cat_parentid] => 11 [cat_name] => zen ) [2] => Array ( [cat_id] => 17 [cat_parentid] => 10 [cat_name] => mercedes ) )I cant understand that on what basis the array is arranged after multisort() here..on alphabhatic order of key or ascending order of values..or what ??thankskarthikanov24

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...