3v4l.org

run code in 300+ PHP versions simultaneously
<?php function arrayWithThree($b=[]) { return [...$b, 3]; } function appendWithReassign($c = []) { return arrayWithThree($c1 = []); } function appendWithoutReassign($c = []) { return arrayWithThree($c); } $a= [1]; echo 'a with three: '.var_export(appendWithReassign($a), true) . ' without reassign: '.var_export(appendWithoutReassign($a), true);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pO6QG
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'appendwithreassign'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $3      
          8        CONCAT                                           ~4      'a+with+three%3A+', $3
          9        CONCAT                                           ~5      ~4, '+without+reassign%3A+'
         10        INIT_FCALL                                               'var_export'
         11        INIT_FCALL                                               'appendwithoutreassign'
         12        SEND_VAR                                                 !0
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $7      
         17        CONCAT                                           ~8      ~5, $7
         18        ECHO                                                     ~8
         19      > RETURN                                                   1

Function arraywiththree:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pO6QG
function name:  arrayWithThree
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <array>
    4     1        INIT_ARRAY                                       ~1      
          2        ADD_ARRAY_UNPACK                                 ~1      !0
          3        ADD_ARRAY_ELEMENT                                ~1      3
          4      > RETURN                                                   ~1
    5     5*     > RETURN                                                   null

End of function arraywiththree

Function appendwithreassign:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pO6QG
function name:  appendWithReassign
number of ops:  7
compiled vars:  !0 = $c, !1 = $c1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV_INIT                                        !0      <array>
    7     1        INIT_FCALL                                               'arraywiththree'
          2        ASSIGN                                           ~2      !1, <array>
          3        SEND_VAL                                                 ~2
          4        DO_FCALL                                      0  $3      
          5      > RETURN                                                   $3
    8     6*     > RETURN                                                   null

End of function appendwithreassign

Function appendwithoutreassign:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pO6QG
function name:  appendWithoutReassign
number of ops:  6
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      <array>
   10     1        INIT_FCALL                                               'arraywiththree'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   11     5*     > RETURN                                                   null

End of function appendwithoutreassign

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.32 ms | 1007 KiB | 18 Q