3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array("100","200","350"); $b = 400; // Is not a array is the finding value; $left = $b; $new_array = []; for($i=0;$i<count($a);$i++) { $new_value[] = max($a[$i]-$left, 0); $left = max($left - $a[$i], 0); } var_dump($new_value);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 6
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 6
Branch analysis from position: 25
Branch analysis from position: 6
filename:       /in/d87rs
function name:  (null)
number of ops:  29
compiled vars:  !0 = $a, !1 = $b, !2 = $left, !3 = $new_array, !4 = $i, !5 = $new_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 400
    7     2        ASSIGN                                                   !2, !1
    8     3        ASSIGN                                                   !3, <array>
    9     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->22
   11     6    >   INIT_FCALL                                               'max'
          7        FETCH_DIM_R                                      ~12     !0, !4
          8        SUB                                              ~13     ~12, !2
          9        SEND_VAL                                                 ~13
         10        SEND_VAL                                                 0
         11        DO_ICALL                                         $14     
         12        ASSIGN_DIM                                               !5
         13        OP_DATA                                                  $14
   12    14        INIT_FCALL                                               'max'
         15        FETCH_DIM_R                                      ~15     !0, !4
         16        SUB                                              ~16     !2, ~15
         17        SEND_VAL                                                 ~16
         18        SEND_VAL                                                 0
         19        DO_ICALL                                         $17     
         20        ASSIGN                                                   !2, $17
    9    21        PRE_INC                                                  !4
         22    >   COUNT                                            ~20     !0
         23        IS_SMALLER                                               !4, ~20
         24      > JMPNZ                                                    ~21, ->6
   15    25    >   INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !5
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.91 ms | 1396 KiB | 17 Q