3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo; public static function create() { $obj = new static(); $obj->nope(); return $obj; } protected function nope() { $this->foo = 'asdf'; } public function getFoo() { return $this->foo; } } $foo = Foo::create(); var_dump($foo->getFoo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2RQXH
function name:  (null)
number of ops:  9
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_STATIC_METHOD_CALL                                  'Foo', 'create'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   18     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getFoo'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function create

Function nope:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2RQXH
function name:  nope
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN_OBJ                                               'foo'
          1        OP_DATA                                                  'asdf'
   12     2      > RETURN                                                   null

End of function nope

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2RQXH
function name:  getFoo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1      > RETURN                                                   ~0
   15     2*     > RETURN                                                   null

End of function getfoo

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.3 ms | 1396 KiB | 15 Q