3v4l.org

run code in 300+ PHP versions simultaneously
<?php $file = "2016/11/2 23:49:34,1,2,3,5 <---Array 0 2016/11/2 23:49:35,2,2,3,9 <---Array 1 2016/11/2 23:49:36,0,2,3,5 <---Array 2 2016/11/2 23:49:37,0,5,3,5 <---Array 3 2016/11/2 23:49:38,0,2,3,5 <---Array 4 2016/11/2 23:49:39,1,2,3,5 <---Array 5 2016/11/2 23:49:40,2,2,3,5 <---Array 6 2016/11/2 23:49:41,3,2,3,5 <---Array 7 2016/11/2 23:49:42,4,2,3,5 <---Array 8 2016/11/2 23:49:43,5,2,7,5 <---Array 9 2016/11/2 23:49:44,0,2,3,5 <---Array 10 2016/11/2 23:49:45,0,2,3,5 <---Array 11 2016/11/2 23:49:46,0,3,5,7 <---Array 12"; // $file = file_get_contents('temp.txt'); $rows = explode("\n", $file); $i = 0; $sum = 0; foreach($rows as $row) { //get row data $row_data = explode(',', $row); $data = $row_data[1]; if($data == 0){ $sum = $sum + $PrevRow; } $PrevRow = $data; $i++; } echo $sum;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 24
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 24
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/2ngJ2
function name:  (null)
number of ops:  27
compiled vars:  !0 = $file, !1 = $rows, !2 = $i, !3 = $sum, !4 = $row, !5 = $row_data, !6 = $data, !7 = $PrevRow
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2016%2F11%2F2+23%3A49%3A34%2C1%2C2%2C3%2C5+%3C---Array+0%0A++++2016%2F11%2F2+23%3A49%3A35%2C2%2C2%2C3%2C9+%3C---Array+1%0A++++2016%2F11%2F2+23%3A49%3A36%2C0%2C2%2C3%2C5+%3C---Array+2%0A++++2016%2F11%2F2+23%3A49%3A37%2C0%2C5%2C3%2C5+%3C---Array+3%0A++++2016%2F11%2F2+23%3A49%3A38%2C0%2C2%2C3%2C5+%3C---Array+4%0A++++2016%2F11%2F2+23%3A49%3A39%2C1%2C2%2C3%2C5+%3C---Array+5%0A++++2016%2F11%2F2+23%3A49%3A40%2C2%2C2%2C3%2C5+%3C---Array+6%0A++++2016%2F11%2F2+23%3A49%3A41%2C3%2C2%2C3%2C5+%3C---Array+7%0A++++2016%2F11%2F2+23%3A49%3A42%2C4%2C2%2C3%2C5+%3C---Array+8%0A++++2016%2F11%2F2+23%3A49%3A43%2C5%2C2%2C7%2C5+%3C---Array+9%0A++++2016%2F11%2F2+23%3A49%3A44%2C0%2C2%2C3%2C5+%3C---Array+10%0A++++2016%2F11%2F2+23%3A49%3A45%2C0%2C2%2C3%2C5+%3C---Array+11%0A++++2016%2F11%2F2+23%3A49%3A46%2C0%2C3%2C5%2C7+%3C---Array+12'
   18     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !1, $9
   19     6        ASSIGN                                                   !2, 0
   20     7        ASSIGN                                                   !3, 0
   21     8      > FE_RESET_R                                       $13     !1, ->24
          9    > > FE_FETCH_R                                               $13, !4, ->24
   24    10    >   INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '%2C'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !5, $14
   25    15        FETCH_DIM_R                                      ~16     !5, 1
         16        ASSIGN                                                   !6, ~16
   26    17        IS_EQUAL                                                 !6, 0
         18      > JMPZ                                                     ~18, ->21
   27    19    >   ADD                                              ~19     !3, !7
         20        ASSIGN                                                   !3, ~19
   29    21    >   ASSIGN                                                   !7, !6
   30    22        PRE_INC                                                  !2
   21    23      > JMP                                                      ->9
         24    >   FE_FREE                                                  $13
   33    25        ECHO                                                     !3
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.81 ms | 1001 KiB | 14 Q