Req #77918 [Opn->Csd]: i need a feature through array.

From: Date: Thu, 18 Apr 2019 13:07:46 +0000
Subject: Req #77918 [Opn->Csd]: i need a feature through array.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220516@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77918&edit=1 ID: 77918 Updated by: girgias@php.net Reported by: anjvelu at gmail dot com Summary: i need a feature through array. -Status: Open +Status: Closed Type: Feature/Change Request Package: Unknown/Other Function PHP Version: Next Major Version -Assigned To: +Assigned To: girgias Block user comment: N Private report: N New Comment: Just have a variable which holds `array(10, 15, 2, 5)` and you can reference this variable in the count function. Previous Comments: ------------------------------------------------------------------------ [2019-04-18 12:56:37] anjvelu at gmail dot com Description: ------------ i need a feature through array. Test script: --------------- function getComments(){ return array( "id" => 1, "comment" => "this is test comment", "favorite_users" => array(10, 15, 2, 5), "favorite_users_count" => count(array(10, 15, 2, 5)) ); } Expected result: ---------------- --- From manual page: https://php.net/language.types.array --- i need a feature through array. function getComments(){ return array( "id" => 1, "comment" => "this is test comment", "favorite_users" => array(10, 15, 2, 5), "favorite_users_count" => count(array(10, 15, 2, 5)) ); } The above function, there is key "favorite_users" having values and the key "favorite_users_count" only holds count of array key "favorite_users". Here the key "favorite_users_count" again setting the values for count array. Is there any way to achieve the count calling the array key "favorite_users". Thanks ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77918&edit=1

« previous php.bugs (#220516) next »