1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
--TEST--
array_walk() tests
--FILE--
<?php
var_dump(array_walk());
$var = 1;
var_dump(array_walk($var,1));
$var = array();
var_dump(array_walk($var,""));
function foo($v1, $v2, $v3) {
var_dump($v1);
var_dump($v2);
var_dump($v3);
}
$var = array(1,2);
var_dump(array_walk($var, "foo", "data"));
function foo2($v1, $v2, $v3) {
throw new Exception($v3);
}
try {
var_dump(array_walk($var,"foo2", "data"));
} catch (Exception $e) {
var_dump($e->getMessage());
}
echo "Done\n";
?>
--EXPECTF--
Warning: array_walk() expects at least 2 parameters, 0 given in %s on line %d
NULL
Warning: array_walk() expects parameter 1 to be array, integer given in %s on line %d
NULL
Warning: array_walk() expects parameter 2 to be a valid callback, function '' not found or invalid function name in %s on line %d
NULL
int(1)
int(0)
string(4) "data"
int(2)
int(1)
string(4) "data"
bool(true)
string(4) "data"
Done
|