3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doWork(callable $f){ $f(); } class P { protected function test(){ echo 'parent'; } } class C extends P{ public function register(){ $c = Closure::fromCallable([$this, 'test']); doWork($c); doWork($this->test(...)); } } (new C)->register();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CoTQL
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $0      'C'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'register'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

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

End of function dowork

Class P:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CoTQL
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'parent'
   10     1      > RETURN                                                   null

End of function test

End of class P.

Class C:
Function register:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CoTQL
function name:  register
number of ops:  16
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                  'Closure', 'fromCallable'
          1        FETCH_THIS                                       ~1      
          2        INIT_ARRAY                                       ~2      ~1
          3        ADD_ARRAY_ELEMENT                                ~2      'test'
          4        SEND_VAL                                                 ~2
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
   16     7        INIT_FCALL                                               'dowork'
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0          
   17    10        INIT_FCALL                                               'dowork'
         11        INIT_METHOD_CALL                                         'test'
         12        ZEND_CALLABLE_CONVERT                            ~6      
         13        SEND_VAL                                                 ~6
         14        DO_FCALL                                      0          
   18    15      > RETURN                                                   null

End of function register

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CoTQL
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                     'parent'
   10     1      > RETURN                                                   null

End of function test

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.74 ms | 1003 KiB | 15 Q