|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41009 new count() mode COUNT_RECURSIVE_VALUES
Submitted: 2007-04-05 22:07 UTC Modified: 2020-03-04 23:34 UTC
From: paulschreiber at gmail dot com Assigned:
Status: Suspended Package: Arrays related
PHP Version: 5.2.1 OS: n/a
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: paulschreiber at gmail dot com
New email:
PHP Version: OS:


 [2007-04-05 22:07 UTC] paulschreiber at gmail dot com
I would like a new count() mode flag, COUNT_RECURSIVE_VALUES, which 
counts the values and not the keys.

Reproduce code:
$b = array(0 => array(2,3), 1 => array(6,7));

// i see 2
print count($b);

// i see 6
print count($b, COUNT_RECURSIVE);

// i want to see "4"
print count($b, COUNT_RECURSIVE_VALUES);

Expected result:

Actual result:
// error


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-29 12:28 UTC]
-Summary: ER: new count() mode COUNT_RECURSIVE_VALUES +Summary: new count() mode COUNT_RECURSIVE_VALUES -Package: Feature/Change Request +Package: Arrays related
 [2020-03-04 23:34 UTC]
-Status: Open +Status: Suspended
 [2020-03-04 23:34 UTC]
Looks like this could be implemented in userland without too much
trouble, and I cannot immediately see a benefit of having this
functionality in PHP core.  That doesn't mean that this couldn't
be a useful feature, but it appears that it should be discussed,
and this bug tracker is rather unsuitable for such discussions.
So I encourage anybody interested in this to bring it up on the
internals mailing list[1].  For the time being, I'm suspending
this ticket.

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 18:04:14 2021 UTC