3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '#PROGRAM "Accounting company" 98.2 #GENERATED 2020715 "SE"'; $quoted = false; $index = 0; $data = []; $rows = explode("\n", $str); $isPreviousSpace = false; foreach ($rows as $row) { $temp = []; $index = 0; $isPreviousSpace = false; for ($i = 0; $i < strlen($row); $i++) { if ($row[$i] === "\"") $quoted = !$quoted; if ($row[$i] === " " && !$quoted) { if (!$isPreviousSpace) { $temp[$index] = $temp[$index] ?? ""; $index++; } $isPreviousSpace = true; continue; } $isPreviousSpace = false; $temp[$index] = ($temp[$index] ?? "") . $row[$i]; } $data[] = $temp; } var_dump($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 53
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 53
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 17
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 38
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 17
Branch analysis from position: 50
Branch analysis from position: 17
Branch analysis from position: 36
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 50, Position 2 = 17
Branch analysis from position: 50
Branch analysis from position: 17
Branch analysis from position: 27
Branch analysis from position: 22
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
filename:       /in/IW0VW
function name:  (null)
number of ops:  58
compiled vars:  !0 = $str, !1 = $quoted, !2 = $index, !3 = $data, !4 = $rows, !5 = $isPreviousSpace, !6 = $row, !7 = $temp, !8 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%23PROGRAM+++%22Accounting+company%22++++98.2%0A+%23GENERATED+++++2020715+%22SE%22'
    7     1        ASSIGN                                                   !1, <false>
    8     2        ASSIGN                                                   !2, 0
    9     3        ASSIGN                                                   !3, <array>
   10     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%0A'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $13     
          8        ASSIGN                                                   !4, $13
   11     9        ASSIGN                                                   !5, <false>
   13    10      > FE_RESET_R                                       $16     !4, ->53
         11    > > FE_FETCH_R                                               $16, !6, ->53
   14    12    >   ASSIGN                                                   !7, <array>
   15    13        ASSIGN                                                   !2, 0
   16    14        ASSIGN                                                   !5, <false>
   17    15        ASSIGN                                                   !8, 0
         16      > JMP                                                      ->47
   18    17    >   FETCH_DIM_R                                      ~21     !6, !8
         18        IS_IDENTICAL                                             ~21, '%22'
         19      > JMPZ                                                     ~22, ->22
         20    >   BOOL_NOT                                         ~23     !1
         21        ASSIGN                                                   !1, ~23
   19    22    >   FETCH_DIM_R                                      ~25     !6, !8
         23        IS_IDENTICAL                                     ~26     ~25, '+'
         24      > JMPZ_EX                                          ~26     ~26, ->27
         25    >   BOOL_NOT                                         ~27     !1
         26        BOOL                                             ~26     ~27
         27    > > JMPZ                                                     ~26, ->38
   20    28    >   BOOL_NOT                                         ~28     !5
         29      > JMPZ                                                     ~28, ->36
   21    30    >   FETCH_DIM_IS                                     ~30     !7, !2
         31        COALESCE                                         ~31     ~30
         32        QM_ASSIGN                                        ~31     ''
         33        ASSIGN_DIM                                               !7, !2
         34        OP_DATA                                                  ~31
   22    35        PRE_INC                                                  !2
   25    36    >   ASSIGN                                                   !5, <true>
   26    37      > JMP                                                      ->46
   28    38    >   ASSIGN                                                   !5, <false>
   30    39        FETCH_DIM_IS                                     ~36     !7, !2
         40        COALESCE                                         ~37     ~36
         41        QM_ASSIGN                                        ~37     ''
         42        FETCH_DIM_R                                      ~38     !6, !8
         43        CONCAT                                           ~39     ~37, ~38
         44        ASSIGN_DIM                                               !7, !2
         45        OP_DATA                                                  ~39
   17    46    >   PRE_INC                                                  !8
         47    >   STRLEN                                           ~41     !6
         48        IS_SMALLER                                               !8, ~41
         49      > JMPNZ                                                    ~42, ->17
   33    50    >   ASSIGN_DIM                                               !3
         51        OP_DATA                                                  !7
   13    52      > JMP                                                      ->11
         53    >   FE_FREE                                                  $16
   36    54        INIT_FCALL                                               'var_dump'
         55        SEND_VAR                                                 !3
         56        DO_ICALL                                                 
         57      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
287.95 ms | 1016 KiB | 15 Q