summaryrefslogtreecommitdiff
path: root/Zend/tests/bug76800.phpt
blob: d7f6d8070b514f162cdc35452e61558a2616a704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
--TEST--
Bug #76800 (foreach inconsistent if array modified during loop)
--FILE--
<?php
$arr = [1 => 1, 3 => 3];           // [1 => 1, 2 => 3] will print both keys
foreach($arr as $key => &$val) {   // without & will print both keys
    echo "See key {$key}\n";
    $arr[0] = 0;                   // without this line will print both keys
    unset($arr[0]);
}
--EXPECT--
See key 1
See key 3