3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private function logError(): bool { debug_print_backtrace(); return true; } } $foo = new Foo(); \Closure::bind(function () use ($foo) { set_error_handler([$foo, 'logError']); }, null, Foo::class)(); // /set_error_handler([$foo, 'logError']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Zf3P
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !0
   16     6        SEND_VAL                                                 ~4
          7        SEND_VAL                                                 null
          8        SEND_VAL                                                 'Foo'
   14     9        DO_FCALL                                      0  $5      
   16    10        INIT_DYNAMIC_CALL                                        $5
         11        DO_FCALL                                      0          
   18    12      > 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/0Zf3P
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   BIND_STATIC                                              !0
   15     1        INIT_FCALL                                               'set_error_handler'
          2        INIT_ARRAY                                       ~1      !0
          3        ADD_ARRAY_ELEMENT                                ~1      'logError'
          4        SEND_VAL                                                 ~1
          5        DO_ICALL                                                 
   16     6      > RETURN                                                   null

End of Dynamic Function 0

Class Foo:
Function logerror:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0Zf3P
function name:  logError
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'debug_print_backtrace'
          1        DO_ICALL                                                 
    8     2      > RETURN                                                   <true>
    9     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function logerror

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.58 ms | 1012 KiB | 15 Q