1--TEST-- 2Test array_map() function : usage variations - string keys 3--FILE-- 4<?php 5 6/* Prototype : array array_map(mixed callback, array input1 [, array input2 ,...]) 7 * Description: Applies the callback to the elements in given arrays. 8 * Source code: ext/standard/array.c 9*/ 10 11 12 13echo "*** Testing array_map() : string keys ***\n"; 14 15$arr = array("stringkey" => "value"); 16function cb1 ($a) {return array ($a);}; 17function cb2 ($a,$b) {return array ($a,$b);}; 18var_dump( array_map("cb1", $arr)); 19var_dump( array_map("cb2", $arr,$arr)); 20var_dump( array_map(null, $arr)); 21var_dump( array_map(null, $arr, $arr)); 22echo "Done"; 23?> 24--EXPECT-- 25*** Testing array_map() : string keys *** 26array(1) { 27 ["stringkey"]=> 28 array(1) { 29 [0]=> 30 string(5) "value" 31 } 32} 33array(1) { 34 [0]=> 35 array(2) { 36 [0]=> 37 string(5) "value" 38 [1]=> 39 string(5) "value" 40 } 41} 42array(1) { 43 ["stringkey"]=> 44 string(5) "value" 45} 46array(1) { 47 [0]=> 48 array(2) { 49 [0]=> 50 string(5) "value" 51 [1]=> 52 string(5) "value" 53 } 54} 55Done 56