3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = "Football / Germany / 1.Liga Football / Germany / 1.Liga Football / Germany / 2.Liga Football / Germany / 2.Liga Football / Germany / 2.Liga Football / England / 1.Liga Football / England / 1.Liga Football / England / 2.Liga Football / England / 2.Liga Football / England / 3.Liga Hockey / Germany / 1.Liga Hockey / Germany / 1.Liga Hockey / Germany / 2.Liga Fechten / Meisterschaft Fechten / Meisterschaft Fechten / Weltmeister"; $lines = explode("\n", $strings); $array = array(); $depth = 0; foreach($lines as $line) { $values = explode(' / ', $line); // find out how deep we have to go if(count($values) > $depth) { $depth = count($values); } } for($i = 0; $i < $depth; $i++) { // run through lines foreach($lines as $line) { $values = explode(' / ', $line); $array[] = $values[$depth]; } } var_dump($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 35
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 24
Branch analysis from position: 39
Branch analysis from position: 24
Branch analysis from position: 35
Branch analysis from position: 21
filename:       /in/LrqI4
function name:  (null)
number of ops:  43
compiled vars:  !0 = $strings, !1 = $lines, !2 = $array, !3 = $depth, !4 = $line, !5 = $values, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Football+%2F+Germany+%2F+1.Liga%0AFootball+%2F+Germany+%2F+1.Liga%0AFootball+%2F+Germany+%2F+2.Liga%0AFootball+%2F+Germany+%2F+2.Liga%0AFootball+%2F+Germany+%2F+2.Liga%0AFootball+%2F+England+%2F+1.Liga%0AFootball+%2F+England+%2F+1.Liga%0AFootball+%2F+England+%2F+2.Liga%0AFootball+%2F+England+%2F+2.Liga%0AFootball+%2F+England+%2F+3.Liga%0AHockey+%2F+Germany+%2F+1.Liga%0AHockey+%2F+Germany+%2F+1.Liga%0AHockey+%2F+Germany+%2F+2.Liga%0AFechten+%2F+Meisterschaft%0AFechten+%2F+Meisterschaft%0AFechten+%2F+Weltmeister'
   19     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
   20     6        ASSIGN                                                   !2, <array>
   22     7        ASSIGN                                                   !3, 0
   23     8      > FE_RESET_R                                       $12     !1, ->21
          9    > > FE_FETCH_R                                               $12, !4, ->21
   24    10    >   INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '+%2F+'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $13     
         14        ASSIGN                                                   !5, $13
   26    15        COUNT                                            ~15     !5
         16        IS_SMALLER                                               !3, ~15
         17      > JMPZ                                                     ~16, ->20
   27    18    >   COUNT                                            ~17     !5
         19        ASSIGN                                                   !3, ~17
   23    20    > > JMP                                                      ->9
         21    >   FE_FREE                                                  $12
   31    22        ASSIGN                                                   !6, 0
         23      > JMP                                                      ->37
   33    24    > > FE_RESET_R                                       $20     !1, ->35
         25    > > FE_FETCH_R                                               $20, !4, ->35
   34    26    >   INIT_FCALL                                               'explode'
         27        SEND_VAL                                                 '+%2F+'
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $21     
         30        ASSIGN                                                   !5, $21
   35    31        FETCH_DIM_R                                      ~24     !5, !3
         32        ASSIGN_DIM                                               !2
         33        OP_DATA                                                  ~24
   33    34      > JMP                                                      ->25
         35    >   FE_FREE                                                  $20
   31    36        PRE_INC                                                  !6
         37    >   IS_SMALLER                                               !6, !3
         38      > JMPNZ                                                    ~26, ->24
   39    39    >   INIT_FCALL                                               'var_dump'
         40        SEND_VAR                                                 !2
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.3 ms | 1400 KiB | 17 Q