find all keys in 2D array
- From: "mtBrains" <martin.tschofen@xxxxxxxxx>
- Date: 21 May 2006 20:30:38 -0700
I have a 2D array. I want to find all sub array items, that are of
[type] => d.
then take the [id] of the found sub items, find any subitems that have
the same id with ":start" attached and take their [level] remove that
subitem and attach [level] to the type d item.
It's easier to explain with some example. I've got the followin array:
Array
(
[0] => Array
(
[id] => assortments
[type] => d
[level] => 1
)
[1] => Array
(
[id] => assortments:categories
[type] => d
[level] => 2
)
[2] => Array
(
[id] => assortments:start
[type] => f
[level] => 3
)
)
I want it to look like this:
Array
(
[0] => Array
(
[id] => assortments
[type] => d
[level] => 3
)
[1] => Array
(
[id] => assortments:categories
[type] => d
[level] => 2
)
)
Notice [3] is gone. It had the same id as [0] with a ':start' attached.
The [level] of that array sub item was then updated on item [0].
TIA..martin
.
- Follow-Ups:
- Re: find all keys in 2D array
- From: Karel de Vos
- Re: find all keys in 2D array
- Prev by Date: Re: PHP_SELF in Buttonproblem in PHP5
- Next by Date: HTML Email Form - PLEASE HELP!!!
- Previous by thread: PHP_SELF in Buttonproblem in PHP5
- Next by thread: Re: find all keys in 2D array
- Index(es):