note 24512 deleted from function.count by googleguy
| From: | googleguy@php.net | Date: | Mon, 17 Sep 2012 00:12:14 +0000 |
| Subject: | note 24512 deleted from function.count by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190831@lists.php.net to get a copy of this message | ||
Note Submitter: simon at invalid dot com
----
Reminder for using count():
<?php
$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:
<?php
$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