+ 2
How can i create function with php that counts array length using foreach loop?
<?php function count_arr($array, limit) $count = 0; foreach ($array as $id => $_array){ $count += count_recursive ($_array, $limit - 1) }else { $count +=1; } } return $count; } ?>
1 ответ
+ 1
easier to use the built-in function in php
sizeof() or count()