3v4l.org

run code in 300+ PHP versions simultaneously
<?php function accept_callable(callable $arg) {} class Foo { public function __construct() { set_error_handler([$this, 'log_error']); set_exception_handler([$this, 'log_exception']); } private function log_error( $type, $message, $file, $line ) { echo "log error" . PHP_EOL; return true; } public function log_exception( $e ) { echo "log exception" . PHP_EOL; var_dump($e); } } $foo = new Foo(); $previousHandler = set_error_handler(static fn () => false); restore_error_handler(); accept_callable($previousHandler);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7Et7
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foo, !1 = $previousHandler
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   24     3        INIT_FCALL                                               'set_error_handler'
          4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
   25     8        INIT_FCALL                                               'restore_error_handler'
          9        DO_ICALL                                                 
   27    10        INIT_FCALL                                               'accept_callable'
         11        SEND_VAR                                                 !1
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7Et7
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E > > RETURN                                                   <false>
          1*     > RETURN                                                   null

End of Dynamic Function 0

Function accept_callable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7Et7
function name:  accept_callable
number of ops:  2
compiled vars:  !0 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function accept_callable

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

End of function __construct

Function log_error:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7Et7
function name:  log_error
number of ops:  7
compiled vars:  !0 = $type, !1 = $message, !2 = $file, !3 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   12     4        ECHO                                                     'log+error%0A'
   13     5      > RETURN                                                   <true>
   14     6*     > RETURN                                                   null

End of function log_error

Function log_exception:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7Et7
function name:  log_exception
number of ops:  6
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        ECHO                                                     'log+exception%0A'
   18     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   19     5      > RETURN                                                   null

End of function log_exception

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.65 ms | 1010 KiB | 18 Q