Jump to content

Natsort multi-dimensional array


Andy-H

Recommended Posts

Does anyone know of a way I can natsort a multi-dimension array by a value nested in the array 2 keys deep?

 

 

I.e.

 

 


array(
   'test1' => array(
      'location' => '123 fake street',
      'time'     => 120
),
'test2' => array(
      'location' => '123 elm street',
      'time'     => 34
),
'test3' => array(
      'location' => '123 php street',
      'time'     => 133
)
);
// would become
array(
'test2' => array(
      'location' => '123 elm street',
      'time'     => 34
),
   'test1' => array(
      'location' => '123 fake street',
      'time'     => 120
),
'test3' => array(
      'location' => '123 php street',
      'time'     => 133
)
);

 

 

thanks for any help

Link to comment
https://forums.phpfreaks.com/topic/256606-natsort-multi-dimensional-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.