2
Test array_map() function : usage variations - failing built-in functions & language constructs
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
11
* Test array_map() by passing non-permmited built-in functions and language constructs i.e.
12
* echo(), array(), empty(), eval(), exit(), isset(), list(), print()
15
echo "*** Testing array_map() : non-permmited built-in functions ***\n";
17
// array to be passed as arguments
20
// built-in functions & language constructs
21
$callback_names = array(
31
for($count = 0; $count < count($callback_names); $count++)
33
echo "-- Iteration ".($count + 1)." --\n";
34
var_dump( array_map($callback_names[$count], $arr1) );
40
*** Testing array_map() : non-permmited built-in functions ***
43
Warning: array_map() expects parameter 1 to be a valid callback, function 'echo' not found or invalid function name in %s on line %d
47
Warning: array_map() expects parameter 1 to be a valid callback, function 'array' not found or invalid function name in %s on line %d
51
Warning: array_map() expects parameter 1 to be a valid callback, function 'empty' not found or invalid function name in %s on line %d
55
Warning: array_map() expects parameter 1 to be a valid callback, function 'eval' not found or invalid function name in %s on line %d
59
Warning: array_map() expects parameter 1 to be a valid callback, function 'exit' not found or invalid function name in %s on line %d
63
Warning: array_map() expects parameter 1 to be a valid callback, function 'isset' not found or invalid function name in %s on line %d
67
Warning: array_map() expects parameter 1 to be a valid callback, function 'list' not found or invalid function name in %s on line %d
71
Warning: array_map() expects parameter 1 to be a valid callback, function 'print' not found or invalid function name in %s on line %d