3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP MyClass::myFunction(MyClass::MYCONST); // THIS GIVES THE ERROR // This is the class.. class MyClass { const MYCONST = 'BLA'; public static function myFunction($key) { if (!defined(this::$key)) { throw new Exception("$key is not defined as a constant"); } } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VNZTr
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_STATIC_METHOD_CALL                                  'MyClass', 'myFunction'
          1        FETCH_CLASS_CONSTANT                             ~0      'MyClass', 'MYCONST'
          2        SEND_VAL_EX                                              ~0
          3        DO_FCALL                                      0          
   14     4      > RETURN                                                   1

Class MyClass:
Function myfunction:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VNZTr
function name:  myFunction
number of ops:  14
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'defined'
          2        FETCH_STATIC_PROP_R          global lock         ~1      'key'
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5        BOOL_NOT                                         ~3      $2
          6      > JMPZ                                                     ~3, ->13
   11     7    >   NEW                                              $4      'Exception'
          8        NOP                                                      
          9        FAST_CONCAT                                      ~5      !0, '+is+not+defined+as+a+constant'
         10        SEND_VAL_EX                                              ~5
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $4
   13    13    > > RETURN                                                   null

End of function myfunction

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.23 ms | 1395 KiB | 15 Q