3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(&$arr) { static $a; var_dump($a); if (!isset($a)) { $a = &$arr; } } $arr = [1, 2, 3]; test($arr); test($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NJuUr
function name:  (null)
number of ops:  8
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'test'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0          
   16     4        INIT_FCALL                                               'test'
          5        SEND_REF                                                 !0
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/NJuUr
function name:  test
number of ops:  10
compiled vars:  !0 = $arr, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        BIND_STATIC                                              !1
    6     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                                 
    7     5        ISSET_ISEMPTY_CV                                 ~3      !1
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->9
    8     8    >   ASSIGN_REF                                               !1, !0
   11     9    > > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
188.64 ms | 1397 KiB | 17 Q