From 95eaf55aa666fdb90b94bfdb6381b94ccbd4ec09 Mon Sep 17 00:00:00 2001 From: Zeev Suraski Date: Thu, 24 Jul 2003 13:21:54 +0000 Subject: Add foreach() test with references --- tests/lang/foreach_with_references_001.phpt | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/lang/foreach_with_references_001.phpt (limited to 'tests') diff --git a/tests/lang/foreach_with_references_001.phpt b/tests/lang/foreach_with_references_001.phpt new file mode 100644 index 0000000000..eb52bb8c10 --- /dev/null +++ b/tests/lang/foreach_with_references_001.phpt @@ -0,0 +1,32 @@ +--TEST-- +foreach() with references +--FILE-- + "one", 2 => "two", 3 => "three"); + +foreach($arr as $key => $val) { + $val = $key; +} + +print_r($arr); + +foreach($arr as $key => &$val) { + $val = $key; +} + +print_r($arr); + +--EXPECT-- +Array +( + [1] => one + [2] => two + [3] => three +) +Array +( + [1] => 1 + [2] => 2 + [3] => 3 +) -- cgit v1.2.1