note 38227 added to function.usort
| From: | wgilk at rn2 dot php dot net | Date: | Fri, 12 Dec 2003 22:30:03 +0000 |
| Subject: | note 38227 added to function.usort | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61876@lists.php.net to get a copy of this message | ||
can someone figure out a way to sort a multi-dimensional associative array?
an example of my data:
---------
$social = array (
array (
"name" => "Civics",
"teacher" => "Bergquist",
"prerequisite" => "",
"notes" => ""
),
array (
"name" => "Personal Finance",
"teacher" => "Bergquist",
"prerequisite" => "",
"notes" => ""
),
array (
"name" => "Psychology",
"teacher" => "E. Holsen",
"prerequisite" => "",
"notes" => ""
),
array (
"name" => "US History",
"teacher" => "Bergquist",
"prerequisite" => "",
"notes" => ""
),
array (
"name" => "Art History",
"teacher" => "K. Holsen",
"prerequisite" => "",
"notes" => ""
),
);
--------------
i would like to sort this data based on the "name" value of each associative array. the
"name", "teacher", etc. should not be displayed, but all of the values need to
but outputted.
i have been beating my head against this one for two days and i can't figure out a good way to
do it.
----
Manual Page -- http://www.php.net/manual/en/function.usort.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38227
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38227&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38227&report=yes
Search -- http://master.php.net/manage/user-notes.php