count统计数组里元素的个数;
strlen是统计数组中元素的长度;php
你若是想统计数组中全部元素的长度,那就用循环统计吧tqeb数组
代码:
$a = array('0' => '123', '1' => 'asdf'); 循环
$count = count($a); 统计
$a_length = 0; co
for ($i=0; $i<$count; $i++) {
$a_length = $a_length + strlen($a[$i]);
}
print $a_length;
代码:
<?phptqeb
$a[0] = 1;
$a[1] = 3;
$a[2] = 5;
$result = count($a);
// $result == 3
$b[0] = 7;
$b[5] = 9;
$b[10] = 11;
$result = count($b);
// $result == 3;
$result = count(null);
// $result == 0
$result = count(false);// $result == 1?>