File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
tests /
lang /
foreachLoop.004.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:06 2012 UTC (12 years, 5 months ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
1: --TEST--
2: Foreach loop tests - using an array element as the $value
3: --FILE--
4: <?php
5:
6: $a=array("a", "b", "c");
7: $v=array();
8: foreach($a as $v[0]) {
9: var_dump($v);
10: }
11: var_dump($a);
12: var_dump($v);
13:
14: echo "\n";
15: $a=array("a", "b", "c");
16: $v=array();
17: foreach($a as $k=>$v[0]) {
18: var_dump($k, $v);
19: }
20: var_dump($a);
21: var_dump($k, $v);
22: ?>
23: --EXPECT--
24: array(1) {
25: [0]=>
26: string(1) "a"
27: }
28: array(1) {
29: [0]=>
30: string(1) "b"
31: }
32: array(1) {
33: [0]=>
34: string(1) "c"
35: }
36: array(3) {
37: [0]=>
38: string(1) "a"
39: [1]=>
40: string(1) "b"
41: [2]=>
42: string(1) "c"
43: }
44: array(1) {
45: [0]=>
46: string(1) "c"
47: }
48:
49: int(0)
50: array(1) {
51: [0]=>
52: string(1) "a"
53: }
54: int(1)
55: array(1) {
56: [0]=>
57: string(1) "b"
58: }
59: int(2)
60: array(1) {
61: [0]=>
62: string(1) "c"
63: }
64: array(3) {
65: [0]=>
66: string(1) "a"
67: [1]=>
68: string(1) "b"
69: [2]=>
70: string(1) "c"
71: }
72: int(2)
73: array(1) {
74: [0]=>
75: string(1) "c"
76: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>