source: src/router/php7/Zend/tests/foreach_list_keyed.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 3 months ago

update php

File size: 437 bytes
Line 
1--TEST--
2foreach with list syntax, keyed
3--FILE--
4<?php
5
6$points = [
7    ["x" => 1, "y" => 2],
8    ["x" => 2, "y" => 1]
9];
10
11foreach ($points as list("x" => $x, "y" => $y)) {
12    var_dump($x, $y);
13}
14
15echo PHP_EOL;
16
17$invertedPoints = [
18    "x" => [1, 2],
19    "y" => [2, 1]
20];
21
22foreach ($invertedPoints as list(0 => $row1, 1 => $row2)) {
23    var_dump($row1, $row2);
24}
25
26?>
27--EXPECT--
28int(1)
29int(2)
30int(2)
31int(1)
32
33int(1)
34int(2)
35int(2)
36int(1)
Note: See TracBrowser for help on using the repository browser.