note 130299 added to control-structures.foreach

From: Date: Tue, 20 May 2025 01:32:44 +0000
Subject: note 130299 added to control-structures.foreach
Groups: php.notes 
Request: Send a blank email to php-notes+get-222148@lists.php.net to get a copy of this message
<?php $array = [ [1, 2, 3], [3, 4, 6], ]; foreach ($array as [$a, $b]) { // Observe que não existe $c aqui. echo "$a $b\n"; } foreach ($array as [, , $c]) { // Pulando $a e $b echo "$c\n"; } ?> I would like to correct this example above! The answer of this algorithm is: 1 2 3 4 3 6 ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 2804:14d:54ab:8108:8e25:13ce:e376:bb11) ---- Manual Page -- https://php.net/manual/en/control-structures.foreach.php Edit -- https://main.php.net/note/edit/130299 Del: integrated -- https://main.php.net/note/delete/130299/integrated Del: useless -- https://main.php.net/note/delete/130299/useless Del: bad code -- https://main.php.net/note/delete/130299/bad+code Del: spam -- https://main.php.net/note/delete/130299/spam Del: non-english -- https://main.php.net/note/delete/130299/non-english Del: in docs -- https://main.php.net/note/delete/130299/in+docs Del: other reasons-- https://main.php.net/note/delete/130299 Reject -- https://main.php.net/note/reject/130299 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222148) next »