3v4l.org

run code in 300+ PHP versions simultaneously
<?php $val = array(array('price' => 700),array('price' => 1000),array('price' => 2000),array('price' => 30000),array('price' => 2000)); print_r($val); $subtract = 3.5; foreach($val as $key => $item){ if ($subtract > $item){ $subtract -= $item; $val[$key] = 0; } else{ $val[$key] -= $subtract; $subtract = 0; } } print_r($val);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 18
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/89143
function name:  (null)
number of ops:  23
compiled vars:  !0 = $val, !1 = $subtract, !2 = $item, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    4     4        ASSIGN                                                   !1, 3.5
    6     5      > FE_RESET_R                                       $7      !0, ->18
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->18
          7    >   ASSIGN                                                   !3, ~8
    7     8        IS_SMALLER                                               !2, !1
          9      > JMPZ                                                     ~10, ->14
    8    10    >   ASSIGN_OP                                     2          !1, !2
    9    11        ASSIGN_DIM                                               !0, !3
         12        OP_DATA                                                  0
         13      > JMP                                                      ->17
   12    14    >   ASSIGN_DIM_OP                -=               2          !0, !3
         15        OP_DATA                                                  !1
   13    16        ASSIGN                                                   !1, 0
    6    17    > > JMP                                                      ->6
         18    >   FE_FREE                                                  $7
   16    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.94 ms | 1387 KiB | 15 Q