Req #41009 [Opn->Sus]: new count() mode COUNT_RECURSIVE_VALUES

From: Date: Wed, 04 Mar 2020 23:34:51 +0000
Subject: Req #41009 [Opn->Sus]: new count() mode COUNT_RECURSIVE_VALUES
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225889@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=41009&edit=1 ID: 41009 Updated by: cmb@php.net Reported by: paulschreiber at gmail dot com Summary: new count() mode COUNT_RECURSIVE_VALUES -Status: Open +Status: Suspended Type: Feature/Change Request Package: Arrays related Operating System: n/a PHP Version: 5.2.1 Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2007-04-05 22:07:11] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=41009&edit=1

« previous php.bugs (#225889) next »