note 119352 added to function.array-map
| From: | mcmurphy510 at gmail dot com | Date: | Thu, 19 May 2016 15:43:24 +0000 |
| Subject: | note 119352 added to function.array-map | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205513@lists.php.net to get a copy of this message | ||
If you are using Namespaces, the array_map callback expects the Fully Qualified NameSpace to be
used.
For example, this won't work:
<?php
namespace Test;
function mapping_function($var) {
...
}
array_map('mapping_function', $array); //won't find 'mapping_function'
here.
?>
This, however, will work:
<?php
namespace Test;
function mapping_function($var) {
...
}
array_map('Test\mapping_function', $array); //using FQNS.
?>
----
Server IP: 72.52.91.14
Probable Submitter: 192.55.54.45
----
Manual Page -- http://php.net/manual/en/function.array-map.php
Edit -- https://master.php.net/note/edit/119352
Del: integrated -- https://master.php.net/note/delete/119352/integrated
Del: useless -- https://master.php.net/note/delete/119352/useless
Del: bad code -- https://master.php.net/note/delete/119352/bad+code
Del: spam -- https://master.php.net/note/delete/119352/spam
Del: non-english -- https://master.php.net/note/delete/119352/non-english
Del: in docs -- https://master.php.net/note/delete/119352/in+docs
Del: other reasons-- https://master.php.net/note/delete/119352
Reject -- https://master.php.net/note/reject/119352
Search -- https://master.php.net/manage/user-notes.php