3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a= []; $b = 'foo'; $c = 'bar'; $a[$b][$c][] = 1; echo "Assign to left-hand side:"; print_it($a,$b,$c); echo "Assign via byref call:"; byref($a[$b][$c]); print_it($a,$b,$c); function byref(&$x) { $x[]= 2; } function print_it($a,$b,$c) { echo "\n"; echo "\n" . json_encode($a); echo "\n" . json_encode($a[$b]); echo "\n" . json_encode($a[$b][$c]); echo "\n\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aPvTD
function name:  (null)
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'foo'
    5     2        ASSIGN                                                   !2, 'bar'
    7     3        FETCH_DIM_W                                      $6      !0, !1
          4        FETCH_DIM_W                                      $7      $6, !2
          5        ASSIGN_DIM                                               $7
          6        OP_DATA                                                  1
    9     7        ECHO                                                     'Assign+to+left-hand+side%3A'
   10     8        INIT_FCALL_BY_NAME                                       'print_it'
          9        SEND_VAR_EX                                              !0
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        DO_FCALL                                      0          
   12    13        ECHO                                                     'Assign+via+byref+call%3A'
   13    14        INIT_FCALL_BY_NAME                                       'byref'
         15        CHECK_FUNC_ARG                                           
         16        FETCH_DIM_FUNC_ARG                               $10     !0, !1
         17        FETCH_DIM_FUNC_ARG                               $11     $10, !2
         18        SEND_FUNC_ARG                                            $11
         19        DO_FCALL                                      0          
   14    20        INIT_FCALL_BY_NAME                                       'print_it'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAR_EX                                              !1
         23        SEND_VAR_EX                                              !2
         24        DO_FCALL                                      0          
   26    25      > RETURN                                                   1

Function byref:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aPvTD
function name:  byref
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  2
   18     3      > RETURN                                                   null

End of function byref

Function print_it:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aPvTD
function name:  print_it
number of ops:  24
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   21     3        ECHO                                                     '%0A'
   22     4        INIT_FCALL                                               'json_encode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        CONCAT                                           ~4      '%0A', $3
          8        ECHO                                                     ~4
   23     9        INIT_FCALL                                               'json_encode'
         10        FETCH_DIM_R                                      ~5      !0, !1
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13        CONCAT                                           ~7      '%0A', $6
         14        ECHO                                                     ~7
   24    15        INIT_FCALL                                               'json_encode'
         16        FETCH_DIM_R                                      ~8      !0, !1
         17        FETCH_DIM_R                                      ~9      ~8, !2
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        CONCAT                                           ~11     '%0A', $10
         21        ECHO                                                     ~11
   25    22        ECHO                                                     '%0A%0A'
   26    23      > RETURN                                                   null

End of function print_it

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.17 ms | 1450 KiB | 14 Q