[PHP-NOTES] note 130458 added to control-structures.foreach

[email protected] ("[email protected]") Mon, 25 Aug 2025 23:58:55 +0000
Newsgroups php.notes
Message-ID <[email protected]>
```
<?php
$array = [
    [1, 2, 3],
    [3, 4, 6],
];

foreach ($array as [$a, $b]) {
    // Note that there is no $c here.
    echo "$a $b\n";
}

foreach ($array as [, , $c]) {
    // Skipping over $a and $b
    echo "$c\n";
}
?>
```

The answer given from PHP.net's echo statement is not correct in the above example. 
There is no way a "5" could be printed. 

The correct answer should be:
1 2
3 4
3 <--Please correct this value to 3 from 5. 
6
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 24.9.88.115)
----
Manual Page -- https://php.net/manual/en/control-structures.foreach.php
Edit        -- https://main.php.net/note/edit/130458
Del: integrated  -- https://main.php.net/note/delete/130458/integrated
Del: useless     -- https://main.php.net/note/delete/130458/useless
Del: bad code    -- https://main.php.net/note/delete/130458/bad+code
Del: spam        -- https://main.php.net/note/delete/130458/spam
Del: non-english -- https://main.php.net/note/delete/130458/non-english
Del: in docs     -- https://main.php.net/note/delete/130458/in+docs
Del: other reasons-- https://main.php.net/note/delete/130458
Reject      -- https://main.php.net/note/reject/130458
Search      -- https://main.php.net/manage/user-notes.php