3
function f($stuff, $thing) {
4
foreach ($stuff as $ii) {}
6
// OK: Only reused for iteration.
8
foreach ($stuff as $ii) {}
11
function g($stuff, $thing) {
12
foreach ($stuff as $thing) {}
14
// OK: Not reused later.
17
function h($stuff, $thing) {
19
// OK: Used afterwards but not before.
21
foreach ($stuff as $key => $val) {}
29
function i($stuff, $thing) {
30
foreach ($stuff as $thing) {
34
// OK: Used afterwards but inside loop.
36
foreach ($stuff as $thing) {
41
function j($stuff, $thing) {
43
foreach ($stuff as $thing) {
47
// ERROR: Clobbers $thing; probably not what the author intended.
52
function k($stuff, $thing) {
53
foreach ($stuff as $thing) {
57
// ERROR: Clobbers $thing. Test case to cover some errors of implementation
58
// where subsequent legitimate foreach()es threw a wrench in the gears.
63
foreach ($other as $item) {}