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($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/MInQd
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 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MInQd
function name:  myFunction
number of ops:  13
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'defined'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->12
   11     6    >   NEW                                              $3      'Exception'
          7        NOP                                                      
          8        FAST_CONCAT                                      ~4      !0, '+is+not+defined+as+a+constant'
          9        SEND_VAL_EX                                              ~4
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $3
   13    12    > > RETURN                                                   null

End of function myfunction

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.05 ms | 1395 KiB | 15 Q