3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getSomethingA() { return 'A'; } function getSomethingB() { return 'B'; } function getSomethingDynamic($method) { // do your summing/averaging in this method // use the passed method name to fetch the desired value return $method(); } echo getSomethingDynamic('getSomethingA'), "\n", getSomethingDynamic('getSomethingb');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B7bcC
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'getsomethingdynamic'
          1        SEND_VAL                                                 'getSomethingA'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   17     4        ECHO                                                     '%0A'
   18     5        INIT_FCALL                                               'getsomethingdynamic'
          6        SEND_VAL                                                 'getSomethingb'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9      > RETURN                                                   1

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

End of function getsomethinga

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

End of function getsomethingb

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

End of function getsomethingdynamic

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.91 ms | 1004 KiB | 15 Q