Sorry for the empty reply (miss slide of the finger on my touch pad).
You can use array_multisort(); The code would look something like
this, remember, this is untested code so be warned before any flaming
is done:

//CODE
//You need to restructure your array like this:
$menu["ID"][1] = 5;
$menu["Title"][1] = "Test 1";
$menu["ID"][2] = 3;
$menu["Title"][2] = "Test 4";
//Then run array_multisort
array_multisort($menu['Title'],$menu['ID']);

//END CODE

Like this it will sort alphabetically or numerically (which ever
needed) ascending. You can put tags after the first variable like
this:

array_multisort($menu['Title'],SORT_ASC,SORT_STRING,$menu['ID']);

If there are any more keys in the $menu array you need to list them
after the $menu['ID'] key so they will be sorted according to the
$menu['Title'] key. The first key you put into array_multisort() is
the one that the rest get sorted by.

-Jasper Howard

On Fri, 1 Oct 2004 22:44:50 -0400, Paul Bissex <[EMAIL PROTECTED]> wrote:
> On Fri, 1 Oct 2004 19:12:30 -0700, Ed Lazor <[EMAIL PROTECTED]> wrote:
> > Any ideas on how I could sort this array by Title?
> >
> > $menu[1]["ID"] = 5;
> >
> > $menu[1]["Title"] = "Test 1";
> >
> > $menu[2]["ID"] = 3;
> >
> > $menu[2]["Title"] = "Test 4";
> 
> 
> uasort() is what you need here.
> 
> Also see the usort() documentation page for an example of how to write
> the comparison callback function that you pass to uasort().
> 
> pb
> 
> --
> paul bissex, e-scribe.com -- database-driven web development
> 413.585.8095
> 69.55.225.29
> 01061-0847
> 72°39'71"W 42°19'42"N
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 



-- 
<<--------------------------------------------------------
Jasper Howard - Database Administration
ApexEleven.com
530 559 0107
------------------------------------------------------->>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to