diff options
| author | Zeev Suraski <zeev@php.net> | 2003-07-24 13:21:54 +0000 |
|---|---|---|
| committer | Zeev Suraski <zeev@php.net> | 2003-07-24 13:21:54 +0000 |
| commit | 95eaf55aa666fdb90b94bfdb6381b94ccbd4ec09 (patch) | |
| tree | 69aca8230a4f442706cde918f6b48be7e570dc74 /tests | |
| parent | d326b809988eed8508459e8f2599219740e3f084 (diff) | |
| download | php-git-95eaf55aa666fdb90b94bfdb6381b94ccbd4ec09.tar.gz | |
Add foreach() test with references
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/lang/foreach_with_references_001.phpt | 32 |
1 files changed, 32 insertions, 0 deletions
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-- +<?php + +$arr = array(1 => "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 +) |
