3v4l.org

run code in 300+ PHP versions simultaneously
<?php class UserType extends Enum { // } class User { private UserType $type; // Getter public function getType(): UserType { return $this->type; } // Domain accessor public function isEmployee(): bool { return $this->type->is(UserType::Employee()); } } $user = new User(); // Getter usage if ($user->getType()->is(UserType::Employee())) { // Do something } // Domain usage if ($user->isEmployee()) { // Do something }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 12
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 12
filename:       /in/cj3ID
function name:  (null)
number of ops:  16
compiled vars:  !0 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'usertype', 'enum'
   23     1        NEW                                              $1      'User'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   26     4        INIT_METHOD_CALL                                         !0, 'getType'
          5        DO_FCALL                                      0  $4      
          6        INIT_METHOD_CALL                                         $4, 'is'
          7        INIT_STATIC_METHOD_CALL                                  'UserType', 'Employee'
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR_NO_REF_EX                                       $5
         10        DO_FCALL                                      0  $6      
         11      > JMPZ                                                     $6, ->12
   31    12    >   INIT_METHOD_CALL                                         !0, 'isEmployee'
         13        DO_FCALL                                      0  $7      
         14      > JMPZ                                                     $7, ->15
   33    15    > > RETURN                                                   1

Class UserType: [no user functions]
Class User:
Function gettype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cj3ID
function name:  getType
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'type'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   14     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function gettype

Function isemployee:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cj3ID
function name:  isEmployee
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_OBJ_R                                      ~0      'type'
          1        INIT_METHOD_CALL                                         ~0, 'is'
          2        INIT_STATIC_METHOD_CALL                                  'UserType', 'Employee'
          3        DO_FCALL                                      0  $1      
          4        SEND_VAR_NO_REF_EX                                       $1
          5        DO_FCALL                                      0  $2      
          6        VERIFY_RETURN_TYPE                                       $2
          7      > RETURN                                                   $2
   20     8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of function isemployee

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.22 ms | 1399 KiB | 13 Q