Re: [PHP] counting nested array

2005-08-17 Thread Robin Vickery
On 8/17/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: OK this the little function i made to solve this.. function countNested($array){ foreach($array as $value){ if(is_array($value)) $total=$this-countNested($value)+$total; }else{

Re: [PHP] counting nested array

2005-08-17 Thread Ing . Josué Aranda
hahaha, thanks robin you save some seconds of mi life... it looks more pro with that if... On 8/17/05, Robin Vickery [EMAIL PROTECTED] wrote: On 8/17/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: OK this the little function i made to solve this.. function countNested($array){

[PHP] counting nested array

2005-08-16 Thread Ing . Josué Aranda
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

Re: [PHP] counting nested array

2005-08-16 Thread Torgny Bjers
Ing. Josué Aranda wrote: 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: [snip] The number of the branches is not always the same.. (it depends on the query).. when i use count($array, COUNT_RECURSIVE) for nested

Re: [PHP] counting nested array

2005-08-16 Thread Robin Vickery
On 8/16/05, Ing. Josué Aranda [EMAIL PROTECTED] wrote: 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

Re: [PHP] counting nested array

2005-08-16 Thread Ing . Josué Aranda
OK this the little function i made to solve this.. [CODE] function countNested($array){ foreach($array as $value){ if(is_array($value)) $total=$this-countNested($value)+$total; }else{ $total=$total+1; } }