PHP (again) differs from other languages ββin that the first part of the assignment is evaluated first. Simple proof:
$a[print 1] = $b[print 2]; // what does this print?
According to http://3v4l.org/ , this code:
$a = array(); $b = array(); $c = 1;
$a[$c++]=$b[$c++];
The following operation codes are generated:
compiled vars: !0 = $a, !1 = $b, !2 = $c
line # * op fetch ext return operands
---------------------------------------------------------------------------------
2 0 > INIT_ARRAY ~0
1 ASSIGN !0, ~0
2 INIT_ARRAY ~2
3 ASSIGN !1, ~2
4 ASSIGN !2, 1
3 5 POST_INC ~5 !2
6 POST_INC ~7 !2
7 FETCH_DIM_R $8 !1, ~7
8 ASSIGN_DIM !0, ~5
9 OP_DATA $8, $9
10 > RETURN 1
5 - $c++, 6 - $c++. , ( 8)
$a[1] = $b[2];
(1,6,3).