3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tax = 0.2; $total = 0; $callback = function ($pricePerItem) use ($tax, $total) { $total += $pricePerItem * ($tax + 1.0); echo "In function: $total\n"; }; $callback(10); echo "After function: $total\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l5GQ9
function name:  (null)
number of ops:  14
compiled vars:  !0 = $tax, !1 = $total, !2 = $callback
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0.2
    4     1        ASSIGN                                                   !1, 0
    7     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fl5GQ9%3A7%240'
          3        BIND_LEXICAL                                             ~5, !0
          4        BIND_LEXICAL                                             ~5, !1
    6     5        ASSIGN                                                   !2, ~5
   13     6        INIT_DYNAMIC_CALL                                        !2
          7        SEND_VAL_EX                                              10
          8        DO_FCALL                                      0          
   15     9        ROPE_INIT                                     3  ~9      'After+function%3A+'
         10        ROPE_ADD                                      1  ~9      ~9, !1
         11        ROPE_END                                      2  ~8      ~9, '%0A'
         12        ECHO                                                     ~8
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fl5GQ9%3A7%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l5GQ9
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $pricePerItem, !1 = $tax, !2 = $total
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        BIND_STATIC                                              !2
    9     3        ADD                                              ~3      !1, 1
          4        MUL                                              ~4      !0, ~3
          5        ASSIGN_OP                                     1          !2, ~4
   10     6        ROPE_INIT                                     3  ~7      'In+function%3A+'
          7        ROPE_ADD                                      1  ~7      ~7, !2
          8        ROPE_END                                      2  ~6      ~7, '%0A'
          9        ECHO                                                     ~6
   11    10      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fl5GQ9%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.86 ms | 1394 KiB | 13 Q