Edit report at https://bugs.php.net/bug.php?id=62749&edit=1
ID: 62749 User updated by: gmblar+php at gmail dot com Reported by: gmblar+php at gmail dot com Summary: array_map should call callback with array index Status: Open Type: Feature/Change Request Package: Arrays related Operating System: MacOSX PHP Version: 5.4.5 Block user comment: N Private report: N New Comment: Correct expected result: ---------------- array(2) { ["foo"]=> string(2) "23:foo" ["bar"]=> string(2) "42:bar" } Previous Comments: ------------------------------------------------------------------------ [2012-08-04 19:14:23] gmblar+php at gmail dot com Description: ------------ Add current array index as second argument to the callback of array_map Test script: --------------- <?php $array = array( 'foo' => 23, 'bar' => 42 ); $result = array_map(function() { return implode(':', func_get_args()); }, $array); var_dump($result); Expected result: ---------------- array(2) { ["foo"]=> string(2) "23:foo" ["bar"]=> string(2) "42:foo" } Actual result: -------------- array(2) { ["foo"]=> string(2) "23" ["bar"]=> string(2) "42" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62749&edit=1