3v4l.org

run code in 300+ PHP versions simultaneously
<?php class closurecaller { public function callByClosure() { var_dump('i am called'); } public function callClosure() { $closure = function() { $this->callByClosure(); }; return $closure; } } $cc = new closurecaller(); call_user_func($cc->callClosure());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y2Ksk
function name:  (null)
number of ops:  8
compiled vars:  !0 = $cc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'closurecaller'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_METHOD_CALL                                         !0, 'callClosure'
          4        DO_FCALL                                      0  $4      
          5        INIT_USER_CALL                                0          'call_user_func', $4
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FY2Ksk%3A12%240

Class closurecaller:
Function callbyclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y2Ksk
function name:  callByClosure
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'i+am+called'
          2        DO_ICALL                                                 
    8     3      > RETURN                                                   null

End of function callbyclosure

Function callclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y2Ksk
function name:  callClosure
number of ops:  4
compiled vars:  !0 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FY2Ksk%3A12%240'
          1        ASSIGN                                                   !0, ~1
   16     2      > RETURN                                                   !0
   17     3*     > RETURN                                                   null

End of function callclosure

End of class closurecaller.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
302.12 ms | 1396 KiB | 16 Q