|
Posted by Curtis on 01/30/07 10:56
On Mon, 29 Jan 2007 06:07:48 -0800, Erwin Moller =
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote:
> craig.keightley@gmail.com wrote:
>
>> i have the following array:
>>
>> Array
>> (
>> [0] =3D> Array
>> (
>> [0] =3D> Leamore Windows Ltd
>> [1] =3D> 553398833511417
>> [2] =3D> 20
>> )
>>
>> [1] =3D> Array
>> (
>> [0] =3D> HRPC
>> [1] =3D> 920589205210538
>> [2] =3D> 1
>> )
>>
>> [2] =3D> Array
>> (
>> [0] =3D> Leamore Windows Ltd
>> [1] =3D> 553398833511417
>> [2] =3D> 2
>> )
>>
>> )
>>
>>
>> is it possible to group the items in the array and order by name to
>> output the following:
>>
>> Array
>> (
>> [0] =3D> Array
>> (
>> [0] =3D> HRPC
>> [1] =3D> 920589205210538
>>
>> [2] =3D> 1
>> )
>>
>> [1] =3D> Array
>> (
>> [0] =3D> Leamore Windows Ltd
>>
>> [1] =3D> 553398833511417
>> [2] =3D> 22
>> )
>>
>>
>> )
>
> Hi,
>
> Have a look at usort()
> http://nl2.php.net/manual/en/function.usort.php
>
> With usort you can define your own sortingrules.
>
> Regards,
> Erwin Moller
The OP may want array_unique. After which, they could sort.
@the OP: you'll probably have to write a recursive function using =
array_unique to handle multi-dimensional arrays.
-- =
Curtis
Navigation:
[Reply to this message]
|