note 128809 added to function.array-map
| From: | alex dot zhirko at gmail dot com | Date: | Wed, 16 Aug 2023 10:23:11 +0000 |
| Subject: | note 128809 added to function.array-map | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220770@lists.php.net to get a copy of this message | ||
As of PHP version 8.0.30, when i tried to run
<?php
$arr = null;
print_r(array_map(function($value){return $value;},$arr));
?>
it thrown an error:
[TypeError]
array_map(): Argument #2 ($array) must be of type array, null given (0)
same code in earlier versions of PHP (i checked PHP 7.4.33) worked fine? i don't know if it is
important, i thought it should be mentioned here
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.157.134 (proxied: 194.158.212.142)
----
Manual Page -- https://php.net/manual/en/function.array-map.php
Edit -- https://main.php.net/note/edit/128809
Del: integrated -- https://main.php.net/note/delete/128809/integrated
Del: useless -- https://main.php.net/note/delete/128809/useless
Del: bad code -- https://main.php.net/note/delete/128809/bad+code
Del: spam -- https://main.php.net/note/delete/128809/spam
Del: non-english -- https://main.php.net/note/delete/128809/non-english
Del: in docs -- https://main.php.net/note/delete/128809/in+docs
Del: other reasons-- https://main.php.net/note/delete/128809
Reject -- https://main.php.net/note/reject/128809
Search -- https://main.php.net/manage/user-notes.php