Not easy! Best way to clean an array of arrays



Hi Guys, I hope someone can help me with this, because i'm getting
crazy to find a good way to do that!

This is what I got by querying a db.

$arr1 = array("site", "description", "area1" , "activity1");
$arr2 = array("site", "description", "area1" , "activity2");
$arr3 = array("site", "description", "area2" , "activity2");
$arr4 = array("site1", "description1", "area3" , "activity2");

$my_array = array($arr1, $arr2, $arr3, $arr4);

Site and description are linked because they are in the same row of
the same table.
But every site can have 1 or more areas and every area can have 1 or
more activity.

I'd like to clean $my_array in a way I can have a compact one without
doubles

//pseudocode!
$new = array (
array('site','descr') => array (
array('area','activity')
)
);
Is it possible??

Thanks for your precious help
Francesco
.



Relevant Pages

  • Re: Shorten Code
    ... Thats really sweet and works great. ... "Dana DeLouis" wrote: ... If you go crazy with too large an array, it can be hard to read and debug. ...
    (microsoft.public.excel.programming)
  • Re: Shorten Code
    ... If you go crazy with too large an array, it can be hard to read and debug. ... cell.HorizontalAlignment = xlCenter ... some of my problem areas that I would like to condense if possible. ...
    (microsoft.public.excel.programming)
  • Re: array and filehandle.
    ... but if the first element of the array is the mode ... any builtin with the function prototype. ... Only perl can parse Perl. ... Looking at code above I've got to crazy conclusion that there are some ...
    (comp.lang.perl.misc)
  • Re: K&R2, exercise 6.4
    ... but it is crazy to use both ... You may sort it later, but that is not the point. ... linked list and at the same time store every one in an array. ...
    (comp.lang.c)
  • Re: preg_replace_callback, carrying variables
    ... $ARRAY looks like this: ... Drives me crazy not to be able to use nowdocs in classes but that's another story... ...
    (comp.lang.php)