3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function test(&$arr) { static $i; 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/q1c35
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 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/q1c35
function name:  test
number of ops:  14
compiled vars:  !0 = $arr, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        BIND_STATIC                                              !1
    7     2        INIT_FCALL                                               'var_dump'
          3        FETCH_STATIC_PROP_R          global lock         ~2      'i'
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
    8     6        ISSET_ISEMPTY_STATIC_PROP                        ~4      'i'
          7        BOOL_NOT                                         ~5      ~4
          8      > JMPZ                                                     ~5, ->13
    9     9    >   FETCH_DIM_W                                      $7      !0, 0
         10        MAKE_REF                                         $8      $7
         11        ASSIGN_STATIC_PROP_REF                                   'i'
         12        OP_DATA                                                  $8
   11    13    > > RETURN                                                   null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.57 ms | 1399 KiB | 15 Q