3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public string $username; public function __construct(string $name) { $this->username = $name; } } interface Factory { public static function make(string $name): object; } class UserFactory implements Factory { public static function make(string $name): User { return new User($name); } } $uf = UserFactory::make("Tiffany"); echo $uf->username;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nGnG
function name:  (null)
number of ops:  8
compiled vars:  !0 = $uf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   DECLARE_CLASS                                            'userfactory'
   26     1        INIT_STATIC_METHOD_CALL                                  'UserFactory', 'make'
          2        SEND_VAL_EX                                              'Tiffany'
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   27     5        FETCH_OBJ_R                                      ~3      !0, 'username'
          6        ECHO                                                     ~3
   28     7      > RETURN                                                   1

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

End of function __construct

End of class User.

Class Factory:
Function make:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nGnG
function name:  make
number of ops:  3
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        VERIFY_RETURN_TYPE                                       
          2      > RETURN                                                   null

End of function make

End of class Factory.

Class UserFactory:
Function make:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4nGnG
function name:  make
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        NEW                                              $1      'User'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        VERIFY_RETURN_TYPE                                       $1
          5      > RETURN                                                   $1
   23     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function make

End of class UserFactory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.36 ms | 1395 KiB | 13 Q