Bug #79312 [Opn->Nab]: array_filter should be more improvement
| From: | cmb@php.net | Date: | Thu, 27 Feb 2020 14:01:51 +0000 |
| Subject: | Bug #79312 [Opn->Nab]: array_filter should be more improvement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225750@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79312&edit=1
ID: 79312
Updated by: cmb@php.net
Reported by: npsingh dot sb at gmail dot com
Summary: array_filter should be more improvement
-Status: Open
+Status: Not a bug
Type: Bug
Package: Filter related
Operating System: Window 7
PHP Version: 7.3.15
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> First, My main concern is FALSE and NULL values not filter
> function array_filter.
Well, that works as it's supposed to, but in your array all
elements are strings (so only an empty string would be filtered
out).
Previous Comments:
------------------------------------------------------------------------
[2020-02-27 13:33:35] npsingh dot sb at gmail dot com
Description:
------------
First, My main concern is FALSE and NULL values not filter function array_filter.
Second, There should be more parameter for array_filter for string and integer type.
Test script:
---------------
$tag_string = 'logo,sky,bird,-0,fire,-1,0,2333,false,logo,FALSE,null,COMPANY,Fire,NULL';
$tag_arr = explode(',', $tag_string );
$tag_arr = array_filter($tag_arr);
print_r($tag_arr);
Expected result:
----------------
Array
(
[0] => logo
[1] => sky
[2] => bird
[3] => fire
[4] => 2333
[5] => logo
[6] => COMPANY
[7] => Fire
)
Actual result:
--------------
Array
(
[0] => logo
[1] => sky
[2] => bird
[3] => -0
[4] => fire
[5] => -1
[7] => 2333
[8] => false
[9] => logo
[10] => FALSE
[11] => null
[12] => COMPANY
[13] => Fire
[14] => NULL
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79312&edit=1