3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ThatRebinds { public function worksWith(Closure $callback): void { $callback->call($this); } private function methodAvailableToCallback(): void { echo __METHOD__; } } class ThatSupplies { public function __construct() { $object = new ThatRebinds(); $object->worksWith(function() { // and it can call $this->methodAvailableToCallback(); }); } } new ThatSupplies;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdq1o
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $0      'ThatSupplies'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
   21     3      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fjdq1o%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdq1o
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       $0      
          1        INIT_METHOD_CALL                                         $0, 'methodAvailableToCallback'
          2        DO_FCALL                                      0          
   17     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fjdq1o%3A14%240

Class ThatRebinds:
Function workswith:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdq1o
function name:  worksWith
number of ops:  6
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_METHOD_CALL                                         !0, 'call'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        DO_FCALL                                      0          
    5     5      > RETURN                                                   null

End of function workswith

Function methodavailabletocallback:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdq1o
function name:  methodAvailableToCallback
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ECHO                                                     'ThatRebinds%3A%3AmethodAvailableToCallback'
    8     1      > RETURN                                                   null

End of function methodavailabletocallback

End of class ThatRebinds.

Class ThatSupplies:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jdq1o
function name:  __construct
number of ops:  8
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'ThatRebinds'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'worksWith'
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fjdq1o%3A14%240'
   17     5        SEND_VAL_EX                                              ~4
          6        DO_FCALL                                      0          
   18     7      > RETURN                                                   null

End of function __construct

End of class ThatSupplies.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.31 ms | 1399 KiB | 13 Q