3v4l.org

run code in 300+ PHP versions simultaneously
<?php function addition ($arg1, $arg2, $formatter) { $total = $arg1 + $arg2; return $formatter($total); } $int_total = addition(1, 2, 'intval'); $float_total = addition(1, 2, 'floatval'); var_dump(array($int_total, $float_total));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U1hOj
function name:  (null)
number of ops:  18
compiled vars:  !0 = $int_total, !1 = $float_total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'addition'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 2
          3        SEND_VAL                                                 'intval'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   13     6        INIT_FCALL                                               'addition'
          7        SEND_VAL                                                 1
          8        SEND_VAL                                                 2
          9        SEND_VAL                                                 'floatval'
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                                   !1, $4
   17    12        INIT_FCALL                                               'var_dump'
         13        INIT_ARRAY                                       ~6      !0
         14        ADD_ARRAY_ELEMENT                                ~6      !1
         15        SEND_VAL                                                 ~6
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function addition:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U1hOj
function name:  addition
number of ops:  10
compiled vars:  !0 = $arg1, !1 = $arg2, !2 = $formatter, !3 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        ADD                                              ~4      !0, !1
          4        ASSIGN                                                   !3, ~4
    6     5        INIT_DYNAMIC_CALL                                        !2
          6        SEND_VAR_EX                                              !3
          7        DO_FCALL                                      0  $6      
          8      > RETURN                                                   $6
    7     9*     > RETURN                                                   null

End of function addition

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.94 ms | 1399 KiB | 17 Q