3v4l.org

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

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

End of function create

Function setfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MHMdM
function name:  setFoo
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
   11     3      > RETURN                                                   null

End of function setfoo

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

End of function getfoo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.09 ms | 1396 KiB | 15 Q