3v4l.org

run code in 500+ PHP versions simultaneously
<?php $foo = <<<PHP define('LOST_CONSTANT', 42); if (true) { class Foo { public function foo() { // throw notice about deprecated constructor } } } PHP; set_error_handler(function($errno, $errstr) { throw new Exception($errstr, $errno); // convert error to exception }); try { eval($foo); } catch (Exception $e) { printf("error %d with message: %s\n", $e->getCode(), $e->getMessage()); } var_dump( class_exists('foo'), // exists! defined('LOST_CONSTANT') // where is my constant );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 7
Branch analysis from position: 7
2 jumps found. (Code = 107) Position 1 = 8, Position 2 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QdWiC
function name:  (null)
number of ops:  24
compiled vars:  !0 = $foo, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'define%28%27LOST_CONSTANT%27%2C+42%29%3B%0A%0Aif+%28true%29+%7B%0A++++class+Foo+%7B%0A++++++++public+function+foo%28%29+%7B%0A++++++++++++%2F%2F+throw+notice+about+deprecated+constructor%0A++++++++%7D%0A++++%7D%0A%7D'
   15     1        INIT_FCALL                                                   'set_error_handler'
          2        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
   17     3        SEND_VAL                                                     ~3
   15     4        DO_ICALL                                                     
   20     5        INCLUDE_OR_EVAL                                              !0, EVAL
          6      > JMP                                                          ->17
   21     7  E > > CATCH                                           last         'Exception'
   22     8    >   INIT_FCALL                                                   'printf'
          9        SEND_VAL                                                     'error+%25d+with+message%3A+%25s%0A'
         10        INIT_METHOD_CALL                                             !1, 'getCode'
         11        DO_FCALL                                          0  $6      
         12        SEND_VAR                                                     $6
         13        INIT_METHOD_CALL                                             !1, 'getMessage'
         14        DO_FCALL                                          0  $7      
         15        SEND_VAR                                                     $7
         16        DO_ICALL                                                     
   25    17    >   INIT_FCALL                                                   'var_dump'
   26    18        FRAMELESS_ICALL_1                class_exists        ~9      'foo'
         19        SEND_VAL                                                     ~9
   27    20        DEFINED                                              ~10     'LOST_CONSTANT'
         21        SEND_VAL                                                     ~10
   25    22        DO_ICALL                                                     
   28    23      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/QdWiC
function name:  {closure:/in/QdWiC:15}
number of ops:  8
compiled vars:  !0 = $errno, !1 = $errstr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   16     2        NEW                                                  $2      'Exception'
          3        SEND_VAR_EX                                                  !1
          4        SEND_VAR_EX                                                  !0
          5        DO_FCALL                                          0          
          6      > THROW                                             0          $2
   17     7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.84 ms | 2111 KiB | 16 Q