3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { var $dd = NULL; } class A { function b() { static $c = null; if (!is_object($c)) $c = new B(); $c->dd++; return $c->dd; } } var_dump(A::b()); var_dump(A::b());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rPfv1
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'A', 'b'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'var_dump'
          6        INIT_STATIC_METHOD_CALL                                  'A', 'b'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class B: [no user functions]
Class A:
Function b:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/rPfv1
function name:  b
number of ops:  11
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    8     1        TYPE_CHECK                                  256  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->7
    9     4    >   NEW                                              $3      'B'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   10     7    >   PRE_INC_OBJ                                              !0, 'dd'
   11     8        FETCH_OBJ_R                                      ~7      !0, 'dd'
          9      > RETURN                                                   ~7
   12    10*     > RETURN                                                   null

End of function b

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.39 ms | 1395 KiB | 15 Q