3v4l.org

run code in 500+ 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 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u2g7K
function name:  getProperty
number of ops:  10
compiled vars:  !0 = $property
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   RECV                                                 !0      
   11     1        FRAMELESS_ICALL_2                property_exists      ~1      'Generic', !0
          2        BOOL_NOT                                             ~2      ~1
          3      > JMPZ                                                         ~2, ->5
   12     4    > > RETURN                                                       'Undefined+Property'
   15     5    >   FETCH_STATIC_PROP_R              unknown             ~3      !0
          6        VERIFY_RETURN_TYPE                                           ~3
          7      > RETURN                                                       ~3
   16     8*       VERIFY_RETURN_TYPE                                           
          9*     > RETURN                                                       null

End of function getproperty

End of class Generic.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.49 ms | 2094 KiB | 14 Q