关于数组,计数,大小OR?

时间:2017-03-04 22:42:20

标签: php

我想从下面的数组中获取计数

CASE 1
Array ( [0] => [1] => [2] => [3] => [4] => [5] => )

CASE 2
Array ( [0] => name [1] => telephone [2] => [3] => [4] => [5] => )

If I use COUNT, results is 5
echo count($array);

我想得0(案例1)和2(案例2)

有办法做到这一点吗?

1 个答案:

答案 0 :(得分:1)

使用此:

$remove_empty = array_filter($your_array);  
print_r($remove_empty);