3v4l.org

run code in 300+ PHP versions simultaneously
<?php function main() { $callback = function() { return 'foo'; }; echo acceptCallable($callback); echo acceptCallable('printBar'); } function printBar() { return 'bar'; } function acceptCallable(Callable $callback) { return $callback(); } main();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Aecl
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   INIT_FCALL                                               'main'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function main:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Aecl
function name:  main
number of ops:  11
compiled vars:  !0 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2Aecl%3A5%240'
          1        ASSIGN                                                   !0, ~1
    9     2        INIT_FCALL_BY_NAME                                       'acceptCallable'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
   10     6        INIT_FCALL_BY_NAME                                       'acceptCallable'
          7        SEND_VAL_EX                                              'printBar'
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
   12    10      > RETURN                                                   null

End of function main

Function %00%7Bclosure%7D%2Fin%2F2Aecl%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Aecl
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E > > RETURN                                                   'foo'
    7     1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2Aecl%3A5%240

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

End of function printbar

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

End of function acceptcallable

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.98 ms | 1399 KiB | 14 Q