1Assignments 2----- 3<?php 4// simple assign 5$a = $b; 6 7// combined assign 8$a &= $b; 9$a |= $b; 10$a ^= $b; 11$a .= $b; 12$a /= $b; 13$a -= $b; 14$a %= $b; 15$a *= $b; 16$a += $b; 17$a <<= $b; 18$a >>= $b; 19$a **= $b; 20$a ??= $b; 21 22// chained assign 23$a = $b *= $c **= $d; 24 25// by ref assign 26$a =& $b; 27 28// list() assign 29list($a) = $b; 30list($a, , $b) = $c; 31list($a, list(, $c), $d) = $e; 32 33// inc/dec 34++$a; 35$a++; 36--$a; 37$a--; 38----- 39array( 40 0: Stmt_Expression( 41 expr: Expr_Assign( 42 var: Expr_Variable( 43 name: a 44 ) 45 expr: Expr_Variable( 46 name: b 47 ) 48 ) 49 comments: array( 50 0: // simple assign 51 ) 52 ) 53 1: Stmt_Expression( 54 expr: Expr_AssignOp_BitwiseAnd( 55 var: Expr_Variable( 56 name: a 57 ) 58 expr: Expr_Variable( 59 name: b 60 ) 61 ) 62 comments: array( 63 0: // combined assign 64 ) 65 ) 66 2: Stmt_Expression( 67 expr: Expr_AssignOp_BitwiseOr( 68 var: Expr_Variable( 69 name: a 70 ) 71 expr: Expr_Variable( 72 name: b 73 ) 74 ) 75 ) 76 3: Stmt_Expression( 77 expr: Expr_AssignOp_BitwiseXor( 78 var: Expr_Variable( 79 name: a 80 ) 81 expr: Expr_Variable( 82 name: b 83 ) 84 ) 85 ) 86 4: Stmt_Expression( 87 expr: Expr_AssignOp_Concat( 88 var: Expr_Variable( 89 name: a 90 ) 91 expr: Expr_Variable( 92 name: b 93 ) 94 ) 95 ) 96 5: Stmt_Expression( 97 expr: Expr_AssignOp_Div( 98 var: Expr_Variable( 99 name: a 100 ) 101 expr: Expr_Variable( 102 name: b 103 ) 104 ) 105 ) 106 6: Stmt_Expression( 107 expr: Expr_AssignOp_Minus( 108 var: Expr_Variable( 109 name: a 110 ) 111 expr: Expr_Variable( 112 name: b 113 ) 114 ) 115 ) 116 7: Stmt_Expression( 117 expr: Expr_AssignOp_Mod( 118 var: Expr_Variable( 119 name: a 120 ) 121 expr: Expr_Variable( 122 name: b 123 ) 124 ) 125 ) 126 8: Stmt_Expression( 127 expr: Expr_AssignOp_Mul( 128 var: Expr_Variable( 129 name: a 130 ) 131 expr: Expr_Variable( 132 name: b 133 ) 134 ) 135 ) 136 9: Stmt_Expression( 137 expr: Expr_AssignOp_Plus( 138 var: Expr_Variable( 139 name: a 140 ) 141 expr: Expr_Variable( 142 name: b 143 ) 144 ) 145 ) 146 10: Stmt_Expression( 147 expr: Expr_AssignOp_ShiftLeft( 148 var: Expr_Variable( 149 name: a 150 ) 151 expr: Expr_Variable( 152 name: b 153 ) 154 ) 155 ) 156 11: Stmt_Expression( 157 expr: Expr_AssignOp_ShiftRight( 158 var: Expr_Variable( 159 name: a 160 ) 161 expr: Expr_Variable( 162 name: b 163 ) 164 ) 165 ) 166 12: Stmt_Expression( 167 expr: Expr_AssignOp_Pow( 168 var: Expr_Variable( 169 name: a 170 ) 171 expr: Expr_Variable( 172 name: b 173 ) 174 ) 175 ) 176 13: Stmt_Expression( 177 expr: Expr_AssignOp_Coalesce( 178 var: Expr_Variable( 179 name: a 180 ) 181 expr: Expr_Variable( 182 name: b 183 ) 184 ) 185 ) 186 14: Stmt_Expression( 187 expr: Expr_Assign( 188 var: Expr_Variable( 189 name: a 190 ) 191 expr: Expr_AssignOp_Mul( 192 var: Expr_Variable( 193 name: b 194 ) 195 expr: Expr_AssignOp_Pow( 196 var: Expr_Variable( 197 name: c 198 ) 199 expr: Expr_Variable( 200 name: d 201 ) 202 ) 203 ) 204 ) 205 comments: array( 206 0: // chained assign 207 ) 208 ) 209 15: Stmt_Expression( 210 expr: Expr_AssignRef( 211 var: Expr_Variable( 212 name: a 213 ) 214 expr: Expr_Variable( 215 name: b 216 ) 217 ) 218 comments: array( 219 0: // by ref assign 220 ) 221 ) 222 16: Stmt_Expression( 223 expr: Expr_Assign( 224 var: Expr_List( 225 items: array( 226 0: ArrayItem( 227 key: null 228 value: Expr_Variable( 229 name: a 230 ) 231 byRef: false 232 unpack: false 233 ) 234 ) 235 ) 236 expr: Expr_Variable( 237 name: b 238 ) 239 ) 240 comments: array( 241 0: // list() assign 242 ) 243 ) 244 17: Stmt_Expression( 245 expr: Expr_Assign( 246 var: Expr_List( 247 items: array( 248 0: ArrayItem( 249 key: null 250 value: Expr_Variable( 251 name: a 252 ) 253 byRef: false 254 unpack: false 255 ) 256 1: null 257 2: ArrayItem( 258 key: null 259 value: Expr_Variable( 260 name: b 261 ) 262 byRef: false 263 unpack: false 264 ) 265 ) 266 ) 267 expr: Expr_Variable( 268 name: c 269 ) 270 ) 271 ) 272 18: Stmt_Expression( 273 expr: Expr_Assign( 274 var: Expr_List( 275 items: array( 276 0: ArrayItem( 277 key: null 278 value: Expr_Variable( 279 name: a 280 ) 281 byRef: false 282 unpack: false 283 ) 284 1: ArrayItem( 285 key: null 286 value: Expr_List( 287 items: array( 288 0: null 289 1: ArrayItem( 290 key: null 291 value: Expr_Variable( 292 name: c 293 ) 294 byRef: false 295 unpack: false 296 ) 297 ) 298 ) 299 byRef: false 300 unpack: false 301 ) 302 2: ArrayItem( 303 key: null 304 value: Expr_Variable( 305 name: d 306 ) 307 byRef: false 308 unpack: false 309 ) 310 ) 311 ) 312 expr: Expr_Variable( 313 name: e 314 ) 315 ) 316 ) 317 19: Stmt_Expression( 318 expr: Expr_PreInc( 319 var: Expr_Variable( 320 name: a 321 ) 322 ) 323 comments: array( 324 0: // inc/dec 325 ) 326 ) 327 20: Stmt_Expression( 328 expr: Expr_PostInc( 329 var: Expr_Variable( 330 name: a 331 ) 332 ) 333 ) 334 21: Stmt_Expression( 335 expr: Expr_PreDec( 336 var: Expr_Variable( 337 name: a 338 ) 339 ) 340 ) 341 22: Stmt_Expression( 342 expr: Expr_PostDec( 343 var: Expr_Variable( 344 name: a 345 ) 346 ) 347 ) 348) 349