3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Generic { public static $propA = "A"; private static $propB = "B"; protected static $propC = "C"; public static function getProperty(string $property): string { if (!property_exists('Generic', $property)) : return "Undefined Property"; endif; return self::$$property; } } print_r(Generic::getProperty('propA')); echo "\n"; print_r(Generic::getProperty('somethingNotDefined'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u2g7K
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_STATIC_METHOD_CALL                                  'Generic', 'getProperty'
          2        SEND_VAL                                                 'propA'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   20     6        ECHO                                                     '%0A'
   21     7        INIT_FCALL                                               'print_r'
          8        INIT_STATIC_METHOD_CALL                                  'Generic', 'getProperty'
          9        SEND_VAL                                                 'somethingNotDefined'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Generic:
Function getproperty:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u2g7K
function name:  getProperty
number of ops:  13
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'property_exists'
          2        SEND_VAL                                                 'Generic'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6      > JMPZ                                                     ~2, ->8
   12     7    > > RETURN                                                   'Undefined+Property'
   15     8    >   FETCH_STATIC_PROP_R          unknown             ~3      !0
          9        VERIFY_RETURN_TYPE                                       ~3
         10      > RETURN                                                   ~3
   16    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function getproperty

End of class Generic.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.71 ms | 1002 KiB | 15 Q