1--TEST--
2Test array_map() function : usage variations - built-in function as callback
3--FILE--
4<?php
5/* Prototype  : array array_map  ( callback $callback  , array $arr1  [, array $...  ] )
6 * Description: Applies the callback to the elements of the given arrays
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Test array_map() by passing buit-in function as callback function
12 */
13
14echo "*** Testing array_map() : built-in function ***\n";
15
16$array1 = array(1, 2, 3);
17$array2 = array(3, 4, 5);
18
19echo "-- with built-in function 'pow' and two parameters --\n";
20var_dump( array_map('pow', $array1, $array2));
21
22echo "-- with built-in function 'pow' and one parameter --\n";
23var_dump( array_map('pow', $array1));
24
25echo "-- with language construct --\n";
26var_dump( array_map('echo', $array1));
27
28echo "Done";
29?>
30--EXPECTF--
31*** Testing array_map() : built-in function ***
32-- with built-in function 'pow' and two parameters --
33array(3) {
34  [0]=>
35  int(1)
36  [1]=>
37  int(16)
38  [2]=>
39  int(243)
40}
41-- with built-in function 'pow' and one parameter --
42
43Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
44
45Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
46
47Warning: pow() expects exactly 2 parameters, 1 given in %s on line %d
48array(3) {
49  [0]=>
50  NULL
51  [1]=>
52  NULL
53  [2]=>
54  NULL
55}
56-- with language construct --
57
58Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
59NULL
60Done
61