[PHP] Re: array_multisort?

2002-01-03 Thread Emile Bosch

waah! You hijacked my topic! :-)

"Sebastiaan Timmers - Bean It" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> 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
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] RE: array_multisort?

2002-01-03 Thread Tim Ward

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  


--
From:  Sebastiaan Timmers - Bean IT [SMTP:[EMAIL PROTECTED]]
Sent:  02 January 2002 13:48
To:  [EMAIL PROTECTED]
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]