note 98846 added to function.array-map
| From: | brendanDOTcaffreyATmeDOTcom at osu1 dot php dot net | Date: | Sat, 10 Jul 2010 22:42:31 +0000 |
| Subject: | note 98846 added to function.array-map | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170867@lists.php.net to get a copy of this message | ||
Something that had me confused:
<?php
namespace test;
class Callback
{
static function add($a) { return $a + 1; }
}
$array = array(0, 1, 2);
array_map(array('Callback', 'add'), $array); // will not work, even though
you're calling this in the test namespace
array_map(array('test\Callback', 'add'), $array); // will work
?>
----
Server IP: 64.71.164.2
Probable Submitter: 69.47.240.41
----
Manual Page -- http://www.php.net/manual/en/function.array-map.php
Edit -- https://master.php.net/note/edit/98846
Del: integrated -- https://master.php.net/note/delete/98846/integrated
Del: useless -- https://master.php.net/note/delete/98846/useless
Del: bad code -- https://master.php.net/note/delete/98846/bad+code
Del: spam -- https://master.php.net/note/delete/98846/spam
Del: non-english -- https://master.php.net/note/delete/98846/non-english
Del: in docs -- https://master.php.net/note/delete/98846/in+docs
Del: other reasons-- https://master.php.net/note/delete/98846
Reject -- https://master.php.net/note/reject/98846
Search -- https://master.php.net/manage/user-notes.php