ID:          31399
 Updated by:  [EMAIL PROTECTED]
 Reported By: sveta at microbecal dot com
-Status:      Open
+Status:      Bogus
 Bug Type:    Documentation problem
 PHP Version: 5CVS-2005-01-04 (dev)
 New Comment:

It stills return 0.
Try echoing its value with: '<? echo count($a); ?>'


Previous Comments:
------------------------------------------------------------------------

[2005-01-04 00:27:25] sveta at microbecal dot com

Description:
------------
In function.count I see:
"count() may return 0 for a variable that isn't set", but is not true
with PHP5 with E_NOTICE turned on

I have tried to patch it:

--- count.xml   2004-11-03 10:30:02.000000000 +0300
+++ count_new.xml       2005-01-01 19:45:24.000000000 +0300
@@ -53,6 +53,8 @@
       isn't set, but it may also return 0 for a variable that has
       been initialized with an empty array. Use
       <function>isset</function> to test if a variable is set.
+      Since PHP 5.0.0, <function>count</function> generates warning of
level
+      <link linkend="errorfunc.constants">E_NOTICE</link> in case of
taking non-initialized variable as parameter.
      </para>
     </caution>
     <para>

Reproduce code:
---------------
count($x);

Expected result:
----------------
0

Actual result:
--------------
Notice: Undefined variable: x in D:\My
Documents\web_project\PHP.lessons\www\reflection.php on line 3


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=31399&edit=1

Reply via email to