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

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

update php

File size: 1.7 KB
Line 
1--TEST--
2list() with keys, evaluation order: nested
3--FILE--
4<?php
5
6require_once "list_keyed_evaluation_order.inc";
7
8$a = new Stringable("A");
9$c = new Stringable("C");
10$f = new Stringable("F");
11$g = new Stringable("G");
12$i = new Stringable("I");
13
14$k = new IndexableRetrievable("K", new Indexable([
15    "A" => "offset value for A",
16    "C" => new Indexable([
17        0 => "offset value for 0",
18        1 => "offset value for 1"
19    ]),
20    "F" => new Indexable([
21        "G" => "offset value for G",
22        "I" => "offset value for I"
23    ])
24]));
25
26$store = new Indexable([]);
27
28// list($a => $b, $c => list($d, $e), $f => list($g => $h, $i => $j)) = $k;
29// Should be evaluated in the order:
30// 1. Evaluate $k
31// 2. Evaluate $a
32// 3. Evaluate $k[$a]
33// 4. Assign $b from $k[$a]
34// 5. Evaluate $c
35// 6. Evaluate $k[$c]
36// 7. Evaluate $k[$c][0]
37// 8. Assign $d from $k[$c][0]
38// 9. Evaluate $k[$c][1]
39// 10. Assign $e from $k[$c][1]
40// 11. Evaluate $f
41// 12. Evaluate $k[$f]
42// 13. Evaluate $g
43// 14. Evaluate $k[$f][$g]
44// 15. Assign $h from $k[$f][$g]
45// 16. Evaluate $i
46// 17. Evaluate $k[$f][$i]
47// 18. Assign $j from $k[$f][$i]
48
49list(
50    (string)$a => $store["B"],
51    (string)$c => list($store["D"], $store["E"]),
52    (string)$f => list(
53        (string)$g => $store["H"],
54        (string)$i => $store["J"]
55    )
56) = $k->getIndexable();
57
58?>
59--EXPECT--
60Indexable K retrieved.
61A evaluated.
62Offset A retrieved.
63Offset B set to offset value for A.
64C evaluated.
65Offset C retrieved.
66Offset 0 retrieved.
67Offset D set to offset value for 0.
68Offset 1 retrieved.
69Offset E set to offset value for 1.
70F evaluated.
71Offset F retrieved.
72G evaluated.
73Offset G retrieved.
74Offset H set to offset value for G.
75I evaluated.
76Offset I retrieved.
77Offset J set to offset value for I.
Note: See TracBrowser for help on using the repository browser.