3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function getBarClass() { return Bar::class; } public function getClassName() { return get_class($this); } } class Bar { protected $name; public function __construct(string $name) { $this->name = $name; } public static function getInstance(...$parameters) { return new Static(...$parameters); } public function getName(): string { return $this->name; } } $foo = new Foo; var_dump($foo->getClassName()::getBarClass()::getInstance('someName')->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vI1CR
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   41     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getClassName'
          5        DO_FCALL                                      0  $4      
          6        FETCH_CLASS                                   0  $5      $4
          7        INIT_STATIC_METHOD_CALL                                  $5, 'getBarClass'
          8        DO_FCALL                                      0  $6      
          9        FETCH_CLASS                                   0  $7      $6
         10        INIT_STATIC_METHOD_CALL                                  $7, 'getInstance'
         11        SEND_VAL_EX                                              'someName'
         12        DO_FCALL                                      0  $8      
         13        INIT_METHOD_CALL                                         $8, 'getName'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

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

End of function getbarclass

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

End of function getclassname

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vI1CR
function name:  __construct
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
   25     1        ASSIGN_OBJ                                               'name'
          2        OP_DATA                                                  !0
   26     3      > RETURN                                                   null

End of function __construct

Function getinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vI1CR
function name:  getInstance
number of ops:  7
compiled vars:  !0 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV_VARIADIC                                    !0      
   30     1        NEW                          static              $1      
          2        SEND_UNPACK                                              !0
          3        CHECK_UNDEF_ARGS                                         
          4        DO_FCALL                                      1          
          5      > RETURN                                                   $1
   31     6*     > RETURN                                                   null

End of function getinstance

Function getname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vI1CR
function name:  getName
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_OBJ_R                                      ~0      'name'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   36     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getname

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.65 ms | 1392 KiB | 15 Q