3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __destruct() { restore_error_handler(); } public function __construct() { set_error_handler(array($this, "callback")); } public function callback($errno, $msg) { echo "my logger: ". $msg ."\n"; return true; } } $a = new A; trigger_error("blarg"); unset($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiEDo
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        INIT_FCALL                                               'trigger_error'
          4        SEND_VAL                                                 'blarg'
          5        DO_ICALL                                                 
   18     6        UNSET_CV                                                 !0
          7      > RETURN                                                   1

Class A:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiEDo
function name:  __destruct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'restore_error_handler'
          1        DO_ICALL                                                 
    6     2      > RETURN                                                   null

End of function __destruct

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiEDo
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'set_error_handler'
          1        FETCH_THIS                                       ~0      
          2        INIT_ARRAY                                       ~1      ~0
          3        ADD_ARRAY_ELEMENT                                ~1      'callback'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
    9     6      > RETURN                                                   null

End of function __construct

Function callback:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LiEDo
function name:  callback
number of ops:  7
compiled vars:  !0 = $errno, !1 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        CONCAT                                           ~2      'my+logger%3A+', !1
          3        CONCAT                                           ~3      ~2, '%0A'
          4        ECHO                                                     ~3
   12     5      > RETURN                                                   <true>
   13     6*     > RETURN                                                   null

End of function callback

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.35 ms | 1396 KiB | 19 Q