note 24512 added to function.count
| From: | simon at invalid dot com | Date: | Tue, 20 Aug 2002 04:40:09 +0000 |
| Subject: | note 24512 added to function.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-35233@lists.php.net to get a copy of this message | ||
Reminder for using count():
$ary = array(null, "a", "b", null);
echo count($ary); // count: 4
$ary[10] = "c";
echo count($ary); // count: 5
$ary[15] = null;
echo count($ary); // count: 6
=> NULL is seen as an element in count()
Count 2D array:
$a2Dary = array(array("a", "b") , array(), "v");
echo count($a2Dary); // count: 3
echo count($a2Dary[0]); //count 2
echo count($a2Dary[1]); // count: 0
echo count($a2Dary[2]); // count: 1
Hope can help you
--
http://www.php.net/manual/en/function.count.php
http://master.php.net/manage/user-notes.php?action=edit+24512
http://master.php.net/manage/user-notes.php?action=delete+24512
http://master.php.net/manage/user-notes.php?action=reject+24512