3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static $i; public function test(&$arr) { var_dump(self::$i); if (!isset(self::$i)) { self::$i = &$arr[0]; } } } $arr = [1, 2, 3]; $a = new A(); $a->test($arr); $a->test($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0LSc9
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, <array>
   16     1        NEW                                              $3      'A'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   17     4        INIT_METHOD_CALL                                         !1, 'test'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   18     7        INIT_METHOD_CALL                                         !1, 'test'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/0LSc9
function name:  test
number of ops:  13
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'var_dump'
          2        FETCH_STATIC_PROP_R          global lock         ~1      'i'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                                 
    8     5        ISSET_ISEMPTY_STATIC_PROP                        ~3      'i'
          6        BOOL_NOT                                         ~4      ~3
          7      > JMPZ                                                     ~4, ->12
    9     8    >   FETCH_DIM_W                                      $6      !0, 0
          9        MAKE_REF                                         $7      $6
         10        ASSIGN_STATIC_PROP_REF                                   'i'
         11        OP_DATA                                                  $7
   11    12    > > RETURN                                                   null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.82 ms | 1395 KiB | 15 Q