arrayDef.test in WPIDE – File Manager & Code Editor 2.3, at PHP-Parser/test/code/parser/expr/arrayDef.test
| 1 | Array definitions |
| 2 | ----- |
| 3 | <?php |
| 4 | |
| 5 | array(); |
| 6 | array('a'); |
| 7 | array('a', ); |
| 8 | array('a', 'b'); |
| 9 | array('a', &$b, 'c' => 'd', 'e' => &$f); |
| 10 | |
| 11 | // short array syntax |
| 12 | []; |
| 13 | [1, 2, 3]; |
| 14 | ['a' => 'b']; |
| 15 | ----- |
| 16 | array( |
| 17 | 0: Expr_Array( |
| 18 | items: array( |
| 19 | ) |
| 20 | ) |
| 21 | 1: Expr_Array( |
| 22 | items: array( |
| 23 | 0: Expr_ArrayItem( |
| 24 | key: null |
| 25 | value: Scalar_String( |
| 26 | value: a |
| 27 | ) |
| 28 | byRef: false |
| 29 | ) |
| 30 | ) |
| 31 | ) |
| 32 | 2: Expr_Array( |
| 33 | items: array( |
| 34 | 0: Expr_ArrayItem( |
| 35 | key: null |
| 36 | value: Scalar_String( |
| 37 | value: a |
| 38 | ) |
| 39 | byRef: false |
| 40 | ) |
| 41 | ) |
| 42 | ) |
| 43 | 3: Expr_Array( |
| 44 | items: array( |
| 45 | 0: Expr_ArrayItem( |
| 46 | key: null |
| 47 | value: Scalar_String( |
| 48 | value: a |
| 49 | ) |
| 50 | byRef: false |
| 51 | ) |
| 52 | 1: Expr_ArrayItem( |
| 53 | key: null |
| 54 | value: Scalar_String( |
| 55 | value: b |
| 56 | ) |
| 57 | byRef: false |
| 58 | ) |
| 59 | ) |
| 60 | ) |
| 61 | 4: Expr_Array( |
| 62 | items: array( |
| 63 | 0: Expr_ArrayItem( |
| 64 | key: null |
| 65 | value: Scalar_String( |
| 66 | value: a |
| 67 | ) |
| 68 | byRef: false |
| 69 | ) |
| 70 | 1: Expr_ArrayItem( |
| 71 | key: null |
| 72 | value: Expr_Variable( |
| 73 | name: b |
| 74 | ) |
| 75 | byRef: true |
| 76 | ) |
| 77 | 2: Expr_ArrayItem( |
| 78 | key: Scalar_String( |
| 79 | value: c |
| 80 | ) |
| 81 | value: Scalar_String( |
| 82 | value: d |
| 83 | ) |
| 84 | byRef: false |
| 85 | ) |
| 86 | 3: Expr_ArrayItem( |
| 87 | key: Scalar_String( |
| 88 | value: e |
| 89 | ) |
| 90 | value: Expr_Variable( |
| 91 | name: f |
| 92 | ) |
| 93 | byRef: true |
| 94 | ) |
| 95 | ) |
| 96 | ) |
| 97 | 5: Expr_Array( |
| 98 | items: array( |
| 99 | ) |
| 100 | ) |
| 101 | 6: Expr_Array( |
| 102 | items: array( |
| 103 | 0: Expr_ArrayItem( |
| 104 | key: null |
| 105 | value: Scalar_LNumber( |
| 106 | value: 1 |
| 107 | ) |
| 108 | byRef: false |
| 109 | ) |
| 110 | 1: Expr_ArrayItem( |
| 111 | key: null |
| 112 | value: Scalar_LNumber( |
| 113 | value: 2 |
| 114 | ) |
| 115 | byRef: false |
| 116 | ) |
| 117 | 2: Expr_ArrayItem( |
| 118 | key: null |
| 119 | value: Scalar_LNumber( |
| 120 | value: 3 |
| 121 | ) |
| 122 | byRef: false |
| 123 | ) |
| 124 | ) |
| 125 | ) |
| 126 | 7: Expr_Array( |
| 127 | items: array( |
| 128 | 0: Expr_ArrayItem( |
| 129 | key: Scalar_String( |
| 130 | value: a |
| 131 | ) |
| 132 | value: Scalar_String( |
| 133 | value: b |
| 134 | ) |
| 135 | byRef: false |
| 136 | ) |
| 137 | ) |
| 138 | ) |
| 139 | ) |