how does array_multisort work?(!??)
| From: | David T-G | Date: | Thu, 18 Mar 2004 19:30:56 +0000 |
| Subject: | how does array_multisort work?(!??) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-180896@lists.php.net to get a copy of this message | ||
Hi, all --
I have an array like
$a =
array
(
'key' =>
array
(
'title' => "Topic Title",
'content' => "Topic Content",
),
...
) ;
and I'd like to sort the whole thing not on the keys but on the titles.
It sounds like array_multisort should do exactly what I want, but I can't
seem to get it to work. For a given source array kind of like
$a
bookmark
How To Bookmark
This is all about bookmarking.
add
Adding Pictures
Let's talk about pictures.
zebra
Caught You Here
This is about zebras but it has a surprise title.
then I want
$a
add
Adding Pictures
Let's talk about pictures.
zebra
Caught You Here
This is about zebras but it has a surprise title.
bookmark
How To Bookmark
This is all about bookmarking.
after sorting.
Will array_multisort sort on an arbitrary key of a multidimensional
array, or does it just sort multidimensional arrays but only in key
index priority?
Barring that, I imagine I'd have to either ensure that the array is
constructed in the proper order or make an index of titles => keys so
that I could sort that and then pull the key out to display the list.
Bleah. Once again it would probably be easier to just lay out a DB
schema!
TIA & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!