3v4l.org

run code in 300+ PHP versions simultaneously
<?php function modify_in_place($prices) { $prices[0] = 100; } function modify_location($prices) { $prices = [40, 50, 60]; } $prices = [1, 2, 3]; modify_in_place($prices); echo ($prices[0] === 100); //false! pass-by-value $prices = [1, 2, 3]; modify_location($prices); echo ($prices[0] === 40); //false! pass-by-value
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZnCFD
function name:  (null)
number of ops:  15
compiled vars:  !0 = $prices
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'modify_in_place'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   13     4        FETCH_DIM_R                                      ~3      !0, 0
          5        IS_IDENTICAL                                     ~4      ~3, 100
          6        ECHO                                                     ~4
   15     7        ASSIGN                                                   !0, <array>
   16     8        INIT_FCALL                                               'modify_location'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0          
   17    11        FETCH_DIM_R                                      ~7      !0, 0
         12        IS_IDENTICAL                                     ~8      ~7, 40
         13        ECHO                                                     ~8
         14      > RETURN                                                   1

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

End of function modify_in_place

Function modify_location:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZnCFD
function name:  modify_location
number of ops:  3
compiled vars:  !0 = $prices
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !0, <array>
    9     2      > RETURN                                                   null

End of function modify_location

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.98 ms | 1402 KiB | 15 Q