Sorting Multidimensional Arrays

From: Date: Mon, 07 May 2001 17:20:34 +0000
Subject: Sorting Multidimensional Arrays
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51780@lists.php.net to get a copy of this message
I'm having trouble finding a function to sort a multidimensional array by the value of a given key in the contained arrays. Perhaps i'm missing something, perhaps PHP is missing something. Take the array below. All I'm looking to do is reorder $my_array based on the value of the "name" key for example--to order $my_array based on the alphabetical order of the "names". $my_array = array ( array ("name"=>"Sam", "age"=>"20", married="yes"), array ("name"=>"Alice", "age"=>"25", married="no"), array ("name"=>"Jim", "age"=>"19", married="no"), array ("name"=>"Janice", "age"=>"22", married="yes") ); Am I missing something that already exists? -Rick

« previous php.general (#51780) next »