3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Legacy { private $_ignore; /** * @param int $ignore */ public function __construct($ignore = E_STRICT) { $this->_ignore = $ignore; } /** * @param callable $func * @return mixed * @throws \Exception */ public function call(callable $func) { $args = func_get_args(); array_shift($args); $er = error_reporting(); error_reporting($er &~ $this->_ignore); try { $ret = call_user_func_array($func, $args); error_reporting($er); return $ret; } catch (\Exception $ex) { error_reporting($er); throw $ex; } } } error_reporting(E_ALL|E_STRICT); var_dump(error_reporting()); (new Legacy())->call(function(){ // strict warningが発生する処理 var_dump(error_reporting()); }); var_dump(error_reporting());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jOLj3
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
   43     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'error_reporting'
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                                 
   44     8        NEW                                              $3      'Legacy'
          9        DO_FCALL                                      0          
         10        INIT_METHOD_CALL                                         $3, 'call'
         11        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FjOLj3%3A44%240'
   47    12        SEND_VAL_EX                                              ~5
         13        DO_FCALL                                      0          
   48    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'error_reporting'
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FjOLj3%3A44%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jOLj3
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'error_reporting'
          2        DO_ICALL                                         $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   47     5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FjOLj3%3A44%240

Class Legacy:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jOLj3
function name:  __construct
number of ops:  4
compiled vars:  !0 = $ignore
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      <const ast>
   11     1        ASSIGN_OBJ                                               '_ignore'
          2        OP_DATA                                                  !0
   12     3      > RETURN                                                   null

End of function __construct

Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 25
Branch analysis from position: 25
2 jumps found. (Code = 107) Position 1 = 26, Position 2 = -2
Branch analysis from position: 26
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/jOLj3
function name:  call
number of ops:  31
compiled vars:  !0 = $func, !1 = $args, !2 = $er, !3 = $ret, !4 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        FUNC_GET_ARGS                                    ~5      
          2        ASSIGN                                                   !1, ~5
   22     3        INIT_FCALL                                               'array_shift'
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   24     6        INIT_FCALL                                               'error_reporting'
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !2, $8
   25     9        INIT_FCALL                                               'error_reporting'
         10        FETCH_OBJ_R                                      ~10     '_ignore'
         11        BW_NOT                                           ~11     ~10
         12        BW_AND                                           ~12     !2, ~11
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                                 
   29    15        INIT_USER_CALL                                0          'call_user_func_array', !0
         16        SEND_ARRAY                                               !1
         17        CHECK_UNDEF_ARGS                                         
         18        DO_FCALL                                      0  $14     
         19        ASSIGN                                                   !3, $14
   30    20        INIT_FCALL                                               'error_reporting'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                                 
   31    23      > RETURN                                                   !3
         24*       JMP                                                      ->30
   33    25  E > > CATCH                                       last         'Exception'
   35    26    >   INIT_FCALL                                               'error_reporting'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
   36    29      > THROW                                         0          !4
   38    30*     > RETURN                                                   null

End of function call

End of class Legacy.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.57 ms | 1392 KiB | 19 Q