counting nested array

From: Date: Tue, 16 Aug 2005 15:30:10 +0000
Subject: counting nested array
Groups: php.general 
Request: Send a blank email to php-general+get-220699@lists.php.net to get a copy of this message
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>>>

« previous php.general (#220699) next »