xref: /PHP-5.4/Zend/tests/007.phpt (revision 58a673a9)
1--TEST--
2each() tests
3--FILE--
4<?php
5
6var_dump(each());
7$var = 1;
8var_dump(each($var));
9$var = "string";
10var_dump(each($var));
11$var = array(1,2,3);
12var_dump(each($var));
13$var = array("a"=>1,"b"=>2,"c"=>3);
14var_dump(each($var));
15
16$a = array(1);
17$a [] =&$a[0];
18
19var_dump(each($a));
20
21
22echo "Done\n";
23?>
24--EXPECTF--
25Warning: each() expects exactly 1 parameter, 0 given in %s on line %d
26NULL
27
28Warning: Variable passed to each() is not an array or object in %s on line %d
29NULL
30
31Warning: Variable passed to each() is not an array or object in %s on line %d
32NULL
33array(4) {
34  [1]=>
35  int(1)
36  ["value"]=>
37  int(1)
38  [0]=>
39  int(0)
40  ["key"]=>
41  int(0)
42}
43array(4) {
44  [1]=>
45  int(1)
46  ["value"]=>
47  int(1)
48  [0]=>
49  string(1) "a"
50  ["key"]=>
51  string(1) "a"
52}
53array(4) {
54  [1]=>
55  int(1)
56  ["value"]=>
57  int(1)
58  [0]=>
59  int(0)
60  ["key"]=>
61  int(0)
62}
63Done
64