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); assert($prices[0] === 100); //failed! pass-by-value $prices = [1, 2, 3]; modify_location($prices); assert($prices[0] === 40); //failed! pass-by-value
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4VSbK
function name:  (null)
number of ops:  23
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        ASSERT_CHECK                                             
          5        INIT_FCALL                                               'assert'
          6        FETCH_DIM_R                                      ~3      !0, 0
          7        IS_IDENTICAL                                     ~4      ~3, 100
          8        SEND_VAL                                                 ~4
          9        SEND_VAL                                                 'assert%28%24prices%5B0%5D+%3D%3D%3D+100%29'
         10        DO_ICALL                                                 
   15    11        ASSIGN                                                   !0, <array>
   16    12        INIT_FCALL                                               'modify_location'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0          
   17    15        ASSERT_CHECK                                             
         16        INIT_FCALL                                               'assert'
         17        FETCH_DIM_R                                      ~8      !0, 0
         18        IS_IDENTICAL                                     ~9      ~8, 40
         19        SEND_VAL                                                 ~9
         20        SEND_VAL                                                 'assert%28%24prices%5B0%5D+%3D%3D%3D+40%29'
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function modify_in_place:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4VSbK
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/4VSbK
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:
180.58 ms | 1399 KiB | 17 Q