Posted by Ing. Josuι Aranda on 08/16/05 18:30
Hi to everyone..
now i have a little problem counting an nested array. Im using it to
fill a Java TreeView... it looks like this:
[1] => Array
(
[1] => Array
(
[1] => Array
(
[1] => LECHE PREMIUM 1 LT
[2] => LECHE PREMIUM 1/2 GL
[3] => LECHE PREMIUM 1 GL
)
[2] => Array
(
[1] => LECHE LIGHT 1 LT
[2] => LECHE LIGHT 1/2 GL
[3] => LECHE FRESCA 1 GL LIGHT
)
[3] => Array
(
[1] => LECHE SEMI 1 LT FRESCA
[2] => LECHE DESLACTOSADA 21 DIAS 1 LT
[3] => LECHE SILUETTE 21 DIAS 1 LT
[4] => LECHE DESARROLLO 21 DIAS 1 LT
[5] => LECHE ENTERA 21 DIAS 1 LT
[6] => LECHE LIGHT 21 DIAS 1 LT
)
[5] => Array
(
[1] => LECHE FRESCA 1 GL SEMIDESCREMADA BELL
[2] => LECHE FRESCA 1/2 GL SEMIDESCREMADA BELL
)
[6] => Array
(
[1] => LECHE FRESCA 1 GL LIGHT BELL
[2] => LECHE FRESCA 1/2 GL LIGHT BELL
[3] => LECHE FRESCA 1 LT LIGHT BELL
)
[7] => Array
(
[1] => LECHE FRESCA 1 GL ENTERA BELL
[2] => LECHE FRESCA 1/2 GL ENTERA BELL
[3] => LECHE FRESCA 1LT ENTERA BELL
)
)
The number of the branches is not always the same.. (it depends on the
query).. when i use count($array, COUNT_RECURSIVE) for nested arrays..
it give to me the total including the nodes in the branches ( in this
case 28).. now here is the question, how i can get only the last nodes
in this case ... exist a easy way to do it?. or its necessary to make
a funcion with a bunch of foreach?.. any suggestions are welcome =o)
thanks!
--
____________________
JOSUE ARANDA>>>
[Back to original message]
|