xref: /PHP-5.4/Zend/tests/list_005.phpt (revision e4c76641)
1--TEST--
2Testing list() with several variables
3--FILE--
4<?php
5
6$a = "foo";
7
8list($a, $b, $c) = $a;
9
10var_dump($a, $b, $c);
11
12print "----\n";
13
14$a = 1;
15
16list($a, $b, $c) = $a;
17
18var_dump($a, $b, $c);
19
20print "----\n";
21
22$a = new stdClass;
23
24list($a, $b, $c) = $a;
25
26var_dump($a, $b, $c);
27
28print "----\n";
29
30$a = array(1, 2, 3);
31
32list($a, $b, $c) = $a;
33
34var_dump($a, $b, $c);
35
36?>
37--EXPECTF--
38string(1) "f"
39string(1) "o"
40string(1) "o"
41----
42NULL
43NULL
44NULL
45----
46
47Fatal error: Cannot use object of type stdClass as array in %s on line %d
48