3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ErrorReportingSwitcher { private $old_flags; public function __construct( $flag_add, $flag_remove = 0 ) { echo __METHOD__ . PHP_EOL; $this->old_flags = error_reporting(); $new_flags = $this->old_flags; if ( $flag_add != 0 ){ $new_flags |= $flag_add; } if ( $flag_remove != 0 ){ $new_flags &= ~$flag_remove; } error_reporting($new_flags); } public function __destruct() { echo __METHOD__ . PHP_EOL; if ( $this->old_flags ){ error_reporting( $this->old_flags ); } } } function hoge() { echo "start\n"; new ErrorReportingSwitcher(0,E_STRICT); // strict warningが発生する処理 echo "end\n"; } hoge();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TTRZ9
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                               'hoge'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function hoge:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TTRZ9
function name:  hoge
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   ECHO                                                     'start%0A'
   34     1        NEW                                              $0      'ErrorReportingSwitcher'
          2        SEND_VAL_EX                                              0
          3        SEND_VAL_EX                                              2048
          4        DO_FCALL                                      0          
          5        FREE                                                     $0
   36     6        ECHO                                                     'end%0A'
   37     7      > RETURN                                                   null

End of function hoge

Class ErrorReportingSwitcher:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
Branch analysis from position: 12
filename:       /in/TTRZ9
function name:  __construct
number of ops:  20
compiled vars:  !0 = $flag_add, !1 = $flag_remove, !2 = $new_flags
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    8     2        ECHO                                                     'ErrorReportingSwitcher%3A%3A__construct%0A'
   10     3        INIT_FCALL                                               'error_reporting'
          4        DO_ICALL                                         $4      
          5        ASSIGN_OBJ                                               'old_flags'
          6        OP_DATA                                                  $4
   11     7        FETCH_OBJ_R                                      ~5      'old_flags'
          8        ASSIGN                                                   !2, ~5
   12     9        IS_NOT_EQUAL                                             !0, 0
         10      > JMPZ                                                     ~7, ->12
   13    11    >   ASSIGN_OP                                     9          !2, !0
   15    12    >   IS_NOT_EQUAL                                             !1, 0
         13      > JMPZ                                                     ~9, ->16
   16    14    >   BW_NOT                                           ~10     !1
         15        ASSIGN_OP                                    10          !2, ~10
   18    16    >   INIT_FCALL                                               'error_reporting'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   19    19      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/TTRZ9
function name:  __destruct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ECHO                                                     'ErrorReportingSwitcher%3A%3A__destruct%0A'
   25     1        FETCH_OBJ_R                                      ~0      'old_flags'
          2      > JMPZ                                                     ~0, ->7
   26     3    >   INIT_FCALL                                               'error_reporting'
          4        FETCH_OBJ_R                                      ~1      'old_flags'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                                 
   28     7    > > RETURN                                                   null

End of function __destruct

End of class ErrorReportingSwitcher.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.67 ms | 1394 KiB | 16 Q