3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL | E_STRICT); // Custom error handler. function handle_error($code, $message, $file, $line, $context) { $code = $code & error_reporting(); if ($code == 0) { // skip @ suppressed errors. return; } $errors = array( E_ERROR => 'E_ERROR', E_WARNING => 'E_WARNING', E_PARSE => 'E_PARSE', E_NOTICE => 'E_NOTICE', E_CORE_ERROR => 'E_CORE_ERROR', E_CORE_WARNING => 'E_CORE_WARNING', E_COMPILE_ERROR => 'E_COMPILE_ERROR', E_COMPILE_WARNING => 'E_COMPILE_WARNING', E_USER_ERROR => 'E_USER_ERROR', E_USER_WARNING => 'E_USER_WARNING', E_USER_NOTICE => 'E_USER_NOTICE', E_STRICT => 'E_STRICT', E_DEPRECATED => 'E_DEPRECATED', ); if (array_key_exists($code, $errors)) { $errname = $errors[$code]; } else { $errname = $code; } $error = "Error handler caught $errname with message \"" . $message . '" at ' . $file . ' line ' . $line . ".\n"; error_log($error); eval(<<<'PHP' function bla() { print "You should see this.\n"; } PHP ); bla($error); return; } set_error_handler('handle_error'); // This fails because bla.php can't be required in error handler: eval(<<<'PHP' namespace MyNamespace { abstract class AbstractFoo { abstract public static function foo(); // PHP 5.3 issues an E_STRICT here about abstract + static, even though it now supports static inheritance. } } PHP );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TjXg7
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   42     3        INIT_FCALL                                               'set_error_handler'
          4        SEND_VAL                                                 'handle_error'
          5        DO_ICALL                                                 
   46     6        INCLUDE_OR_EVAL                                          'namespace+MyNamespace+%7B%0A%09abstract+class+AbstractFoo+%7B%0A%09%09abstract+public+static+function+foo%28%29%3B+%2F%2F+PHP+5.3+issues+an+E_STRICT+here+about+abstract+%2B+static%2C+even+though+it+now+supports+static+inheritance.%0A%09%7D%0A%7D', EVAL
   52     7      > RETURN                                                   1

Function handle_error:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TjXg7
function name:  handle_error
number of ops:  38
compiled vars:  !0 = $code, !1 = $message, !2 = $file, !3 = $line, !4 = $context, !5 = $errors, !6 = $errname, !7 = $error
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
    6     5        INIT_FCALL                                               'error_reporting'
          6        DO_ICALL                                         $8      
          7        BW_AND                                           ~9      !0, $8
          8        ASSIGN                                                   !0, ~9
    7     9        IS_EQUAL                                                 !0, 0
         10      > JMPZ                                                     ~11, ->12
    8    11    > > RETURN                                                   null
   10    12    >   ASSIGN                                                   !5, <array>
   25    13        ARRAY_KEY_EXISTS                                         !0, !5
         14      > JMPZ                                                     ~13, ->18
   26    15    >   FETCH_DIM_R                                      ~14     !5, !0
         16        ASSIGN                                                   !6, ~14
         17      > JMP                                                      ->19
   29    18    >   ASSIGN                                                   !6, !0
   31    19    >   ROPE_INIT                                     3  ~18     'Error+handler+caught+'
         20        ROPE_ADD                                      1  ~18     ~18, !6
         21        ROPE_END                                      2  ~17     ~18, '+with+message+%22'
         22        CONCAT                                           ~20     ~17, !1
         23        CONCAT                                           ~21     ~20, '%22+at+'
         24        CONCAT                                           ~22     ~21, !2
         25        CONCAT                                           ~23     ~22, '+line+'
         26        CONCAT                                           ~24     ~23, !3
         27        CONCAT                                           ~25     ~24, '.%0A'
         28        ASSIGN                                                   !7, ~25
   32    29        INIT_FCALL                                               'error_log'
         30        SEND_VAR                                                 !7
         31        DO_ICALL                                                 
   34    32        INCLUDE_OR_EVAL                                          'function+bla%28%29+%7B%0A%09print+%22You+should+see+this.%5Cn%22%3B%0A%7D', EVAL
   39    33        INIT_FCALL_BY_NAME                                       'bla'
         34        SEND_VAR_EX                                              !7
         35        DO_FCALL                                      0          
   40    36      > RETURN                                                   null
   41    37*     > RETURN                                                   null

End of function handle_error

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
191.24 ms | 1405 KiB | 19 Q