3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timesTwo($num, $callback) { $num = $num*2; echo "num from timesTwo: ".$num.PHP_EOL; return call_user_func_array($callback, array($num)); } function addOne($num) { echo 'Num from add 1: '.$num.PHP_EOL; return $num + 1; } echo timesTwo(5, 'addOne'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pXQIN
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'timestwo'
          1        SEND_VAL                                                 5
          2        SEND_VAL                                                 'addOne'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   18     5      > RETURN                                                   1

Function timestwo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pXQIN
function name:  timesTwo
number of ops:  14
compiled vars:  !0 = $num, !1 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        MUL                                              ~2      !0, 2
          3        ASSIGN                                                   !0, ~2
    5     4        CONCAT                                           ~4      'num+from+timesTwo%3A+', !0
          5        CONCAT                                           ~5      ~4, '%0A'
          6        ECHO                                                     ~5
    6     7        INIT_USER_CALL                                0          'call_user_func_array', !1
          8        INIT_ARRAY                                       ~6      !0
          9        SEND_ARRAY                                               ~6
         10        CHECK_UNDEF_ARGS                                         
         11        DO_FCALL                                      0  $7      
         12      > RETURN                                                   $7
    7    13*     > RETURN                                                   null

End of function timestwo

Function addone:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pXQIN
function name:  addOne
number of ops:  7
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        CONCAT                                           ~1      'Num+from+add+1%3A+', !0
          2        CONCAT                                           ~2      ~1, '%0A'
          3        ECHO                                                     ~2
   11     4        ADD                                              ~3      !0, 1
          5      > RETURN                                                   ~3
   12     6*     > RETURN                                                   null

End of function addone

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.94 ms | 1399 KiB | 14 Q