3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = <<<PHP const LOST_CONSTANT_BEFORE = 42; class Foo { public function foo() { // throw notice about deprecated constructor } } const LOST_CONSTANT_AFTER = 42; 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_BEFORE'), // where is my constant defined('LOST_CONSTANT_AFTER') // 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/h02r8
function name:  (null)
number of ops:  28
compiled vars:  !0 = $foo, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'const+LOST_CONSTANT_BEFORE+%3D+42%3B%0A%0Aclass+Foo+%7B%0A+++public+function+foo%28%29+%7B%0A++++++%2F%2F+throw+notice+about+deprecated+constructor%0A+++%7D%0A%7D%0A%0Aconst+LOST_CONSTANT_AFTER+%3D+42%3B'
   15     1        INIT_FCALL                                               'set_error_handler'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fh02r8%3A15%240'
   17     3        SEND_VAL                                                 ~3
          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        INIT_FCALL                                               'class_exists'
         19        SEND_VAL                                                 'foo'
         20        DO_ICALL                                         $9      
         21        SEND_VAR                                                 $9
   27    22        DEFINED                                          ~10     'LOST_CONSTANT_BEFORE'
         23        SEND_VAL                                                 ~10
   28    24        DEFINED                                          ~11     'LOST_CONSTANT_AFTER'
         25        SEND_VAL                                                 ~11
         26        DO_ICALL                                                 
   29    27      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fh02r8%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/h02r8
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2Fh02r8%3A15%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.9 ms | 1400 KiB | 21 Q