3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EmptyObj{ protected function __construct(){} public static function get(){ static $obj; if(!$obj) $obj = new EmptyObj; return $obj; } public function __call($n, $a){ return $this; } } class SomeClass{ public $image; public function __construct(){ $this->image = EmptyObj::get(); }} $a = new SomeClass; $a->image->oopsForgotToSetImage();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4aeG
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'SomeClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   20     3        FETCH_OBJ_R                                      ~4      !0, 'image'
          4        INIT_METHOD_CALL                                         ~4, 'oopsForgotToSetImage'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class EmptyObj:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4aeG
function name:  __construct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   null

End of function __construct

Function get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/k4aeG
function name:  get
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    6     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
    7     3    >   NEW                                              $2      'EmptyObj'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    8     6    > > RETURN                                                   !0
    9     7*     > RETURN                                                   null

End of function get

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4aeG
function name:  __call
number of ops:  5
compiled vars:  !0 = $n, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        FETCH_THIS                                       ~2      
          3      > RETURN                                                   ~2
   12     4*     > RETURN                                                   null

End of function __call

End of class EmptyObj.

Class SomeClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/k4aeG
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'EmptyObj', 'get'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN_OBJ                                               'image'
          3        OP_DATA                                                  $1
   18     4      > RETURN                                                   null

End of function __construct

End of class SomeClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.23 ms | 1399 KiB | 13 Q