RE: array_multisort?
| From: | Tim Ward | Date: | Thu, 03 Jan 2002 11:34:13 +0000 |
| Subject: | RE: array_multisort? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79300@lists.php.net to get a copy of this message | ||
If title can be guaranteed to be unique then just amend your code to
...
$product = array($id, $title, $price);
$shop[$title] = $product;
if not then you'll have to make the key unique, something like ...
$product = array($id, $title, $price);
$shop[$title . "..." . $counter++] = $product;
you can then use the normal array sorting functions on $shop
Tim
www.chessish.com <http://www.chessish.com>
----------
From: Sebastiaan Timmers - Bean IT [SMTP:sebastiaan@bean-it.nl]
Sent: 02 January 2002 13:48
To: php-general@lists.php.net
Subject: array_multisort?
Hi List,
I'm having a problem sorting the following array:
$product = array($id, $title, $price);
$shop[] = $product;
I want the array 'shop' to be sorted by the 'title' in array
'product'. I
tried the function 'array_multisort()', but that did not do the
trick.
Does anyone know how to fix this?
Best regards,
Sebastiaan Timmers