note 129360 added to arrayobject.count
| From: | bienvenunet@yahoo.com | Date: | Thu, 28 Mar 2024 14:01:08 +0000 |
| Subject: | note 129360 added to arrayobject.count | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221260@lists.php.net to get a copy of this message | ||
<?php
$array_object = new \ArrayObject([]);
echo count($array_object); // echos 1 ?!?
echo count($this->getArrayCopy()); // echos the correct answer, 0
?>
Make it make sense. I've spent a few hours trying to figure out why simple tests were failing
and had to look this up to figure this out.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.131 (proxied: 66.186.248.122)
----
Manual Page -- https://php.net/manual/en/arrayobject.count.php
Edit -- https://main.php.net/note/edit/129360
Del: integrated -- https://main.php.net/note/delete/129360/integrated
Del: useless -- https://main.php.net/note/delete/129360/useless
Del: bad code -- https://main.php.net/note/delete/129360/bad+code
Del: spam -- https://main.php.net/note/delete/129360/spam
Del: non-english -- https://main.php.net/note/delete/129360/non-english
Del: in docs -- https://main.php.net/note/delete/129360/in+docs
Del: other reasons-- https://main.php.net/note/delete/129360
Reject -- https://main.php.net/note/reject/129360
Search -- https://main.php.net/manage/user-notes.php