#47697 [Opn->Bgs]: Count function returning 1 for an object
| From: | felipe@php.net | Date: | Tue, 17 Mar 2009 22:34:12 +0000 |
| Subject: | #47697 [Opn->Bgs]: Count function returning 1 for an object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-134840@lists.php.net to get a copy of this message | ||
ID: 47697
Updated by: felipe@php.net
Reported By: justinvex at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: *General Issues
Operating System: Linux
PHP Version: 5.2.9
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Says the documentation:
"If var is not an array or an object with implemented Countable
interface, 1 will be returned [...]"
Previous Comments:
------------------------------------------------------------------------
[2009-03-17 22:13:22] justinvex at yahoo dot com
Description:
------------
Hi this is returning 1 when I think it should return 3 for the number
of
properties in the object. Maybe I am doing this wrong. Thanks...
Reproduce code:
---------------
$i = new StdClass();
$i->propOne = "Prop 1";
$i->propTwo = "Prop 2";
$i->propThree = "Prop 3";
print count($i);
Expected result:
----------------
prints 3
Actual result:
--------------
prints 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47697&edit=1