php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-04-05 22:07 UTC] paulschreiber at gmail dot com
Description:
------------
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:
----------------
2
6
4

Actual result:
--------------
2
6
// error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-29 12:28 UTC] cmb@php.net
-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] cmb@php.net
-Status: Open +Status: Suspended
 [2020-03-04 23:34 UTC] cmb@php.net
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] <https://www.php.net/mailing-lists.php#internals>
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 19:01:27 2020 UTC