xref: /PHP-5.3/Zend/tests/bug40705.phpt (revision 610c7fbe)
1--TEST--
2Bug #40705 (Iterating within function moves original array pointer)
3--FILE--
4<?php
5function doForeach($array)
6{
7    foreach ($array as $k => $v) {
8        // do stuff
9    }
10}
11
12$foo = array('foo', 'bar', 'baz');
13var_dump(key($foo));
14doForeach($foo);
15var_dump(key($foo));
16foreach ($foo as $k => $v) {
17	var_dump($k);
18}
19var_dump(key($foo));
20--EXPECT--
21int(0)
22int(0)
23int(0)
24int(1)
25int(2)
26NULL
27