3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrays = array("foo-1" => array(array("A", 3), array("B", 3)), "foo-2" => array(array("A", 1), array("B", 7)), "foo-3" => array(array("A", 1), array("B", 6))); $names = "("; $letters = "("; $numbers = ""; $coordinate = ""; foreach($arrays as $arrayName => $array) { if(array_search($arrayName, array_keys($arrays)) == 0) { $names .= $arrayName; }else{ $names .= ",".$arrayName; } foreach($array as $key => $nestedArray) { foreach($nestedArray as $letterOrNum => $value) { if($letterOrNum == 0) { // it's a letter if($key + 1 == 1) { $nextLetter = $array[$key + 1][0]; if (!strpos($letters, $value.','.$nextLetter) !== false) { if($key == 0 && array_search($arrayName, array_keys($arrays)) == 0) { $letters .= $value; }else{ $letters .= ",".$value; } } }else{ $previousLetter = $array[$key - 1][0]; if (!strpos($letters, $previousLetter.','.$value) !== false) { if($key == 0 && array_search($arrayName, array_keys($arrays)) == 0) { $letters .= $value; }else{ $letters .= ",".$value; } } } }else{ // its a number if($key == 0) { $coordinate .= "(".$value.","; }else{ $coordinate .= $value.")"; } $numbers .= $coordinate; $coordinate = ""; } } } } $names .= ")"; $letters .= ")"; echo $names; echo $letters; echo $numbers;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 107
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 107
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 105
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 105
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 103
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 103
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 92
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 62
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 61
Branch analysis from position: 45
2 jumps found. (Code = 46) Position 1 = 47, Position 2 = 56
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 59
Branch analysis from position: 57
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
1 jumps found. (Code = 42) Position 1 = 102
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
Branch analysis from position: 56
Branch analysis from position: 61
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 75, Position 2 = 91
Branch analysis from position: 75
2 jumps found. (Code = 46) Position 1 = 77, Position 2 = 86
Branch analysis from position: 77
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 89
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 91
Branch analysis from position: 91
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 102
Branch analysis from position: 102
Branch analysis from position: 86
Branch analysis from position: 91
Branch analysis from position: 92
2 jumps found. (Code = 43) Position 1 = 94, Position 2 = 98
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 100
Branch analysis from position: 100
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 98
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 103
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 103
Branch analysis from position: 105
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 105
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 105
Branch analysis from position: 22
Branch analysis from position: 105
Branch analysis from position: 107
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 107
filename:       /in/mMoT6
function name:  (null)
number of ops:  114
compiled vars:  !0 = $arrays, !1 = $names, !2 = $letters, !3 = $numbers, !4 = $coordinate, !5 = $array, !6 = $arrayName, !7 = $nestedArray, !8 = $key, !9 = $value, !10 = $letterOrNum, !11 = $nextLetter, !12 = $previousLetter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, '%28'
    6     2        ASSIGN                                                   !2, '%28'
    7     3        ASSIGN                                                   !3, ''
    8     4        ASSIGN                                                   !4, ''
   10     5      > FE_RESET_R                                       $18     !0, ->107
          6    > > FE_FETCH_R                                       ~19     $18, !5, ->107
          7    >   ASSIGN                                                   !6, ~19
   11     8        INIT_FCALL                                               'array_search'
          9        SEND_VAR                                                 !6
         10        INIT_FCALL                                               'array_keys'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $21     
         13        SEND_VAR                                                 $21
         14        DO_ICALL                                         $22     
         15        IS_EQUAL                                                 $22, 0
         16      > JMPZ                                                     ~23, ->19
   12    17    >   ASSIGN_OP                                     8          !1, !6
   11    18      > JMP                                                      ->21
   14    19    >   CONCAT                                           ~25     '%2C', !6
         20        ASSIGN_OP                                     8          !1, ~25
   16    21    > > FE_RESET_R                                       $27     !5, ->105
         22    > > FE_FETCH_R                                       ~28     $27, !7, ->105
         23    >   ASSIGN                                                   !8, ~28
   17    24      > FE_RESET_R                                       $30     !7, ->103
         25    > > FE_FETCH_R                                       ~31     $30, !9, ->103
         26    >   ASSIGN                                                   !10, ~31
   18    27        IS_EQUAL                                                 !10, 0
         28      > JMPZ                                                     ~33, ->92
   19    29    >   ADD                                              ~34     !8, 1
         30        IS_EQUAL                                                 ~34, 1
         31      > JMPZ                                                     ~35, ->62
   20    32    >   ADD                                              ~36     !8, 1
         33        FETCH_DIM_R                                      ~37     !5, ~36
         34        FETCH_DIM_R                                      ~38     ~37, 0
         35        ASSIGN                                                   !11, ~38
   21    36        INIT_FCALL                                               'strpos'
         37        SEND_VAR                                                 !2
         38        CONCAT                                           ~40     !9, '%2C'
         39        CONCAT                                           ~41     ~40, !11
         40        SEND_VAL                                                 ~41
         41        DO_ICALL                                         $42     
         42        BOOL_NOT                                         ~43     $42
         43        TYPE_CHECK                                  1018          ~43
         44      > JMPZ                                                     ~44, ->61
   22    45    >   IS_EQUAL                                         ~45     !8, 0
         46      > JMPZ_EX                                          ~45     ~45, ->56
         47    >   INIT_FCALL                                               'array_search'
         48        SEND_VAR                                                 !6
         49        INIT_FCALL                                               'array_keys'
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $46     
         52        SEND_VAR                                                 $46
         53        DO_ICALL                                         $47     
         54        IS_EQUAL                                         ~48     $47, 0
         55        BOOL                                             ~45     ~48
         56    > > JMPZ                                                     ~45, ->59
   23    57    >   ASSIGN_OP                                     8          !2, !9
   22    58      > JMP                                                      ->61
   25    59    >   CONCAT                                           ~50     '%2C', !9
         60        ASSIGN_OP                                     8          !2, ~50
   19    61    > > JMP                                                      ->91
   29    62    >   SUB                                              ~52     !8, 1
         63        FETCH_DIM_R                                      ~53     !5, ~52
         64        FETCH_DIM_R                                      ~54     ~53, 0
         65        ASSIGN                                                   !12, ~54
   30    66        INIT_FCALL                                               'strpos'
         67        SEND_VAR                                                 !2
         68        CONCAT                                           ~56     !12, '%2C'
         69        CONCAT                                           ~57     ~56, !9
         70        SEND_VAL                                                 ~57
         71        DO_ICALL                                         $58     
         72        BOOL_NOT                                         ~59     $58
         73        TYPE_CHECK                                  1018          ~59
         74      > JMPZ                                                     ~60, ->91
   31    75    >   IS_EQUAL                                         ~61     !8, 0
         76      > JMPZ_EX                                          ~61     ~61, ->86
         77    >   INIT_FCALL                                               'array_search'
         78        SEND_VAR                                                 !6
         79        INIT_FCALL                                               'array_keys'
         80        SEND_VAR                                                 !0
         81        DO_ICALL                                         $62     
         82        SEND_VAR                                                 $62
         83        DO_ICALL                                         $63     
         84        IS_EQUAL                                         ~64     $63, 0
         85        BOOL                                             ~61     ~64
         86    > > JMPZ                                                     ~61, ->89
   32    87    >   ASSIGN_OP                                     8          !2, !9
   31    88      > JMP                                                      ->91
   34    89    >   CONCAT                                           ~66     '%2C', !9
         90        ASSIGN_OP                                     8          !2, ~66
   18    91    > > JMP                                                      ->102
   39    92    >   IS_EQUAL                                                 !8, 0
         93      > JMPZ                                                     ~68, ->98
   40    94    >   CONCAT                                           ~69     '%28', !9
         95        CONCAT                                           ~70     ~69, '%2C'
         96        ASSIGN_OP                                     8          !4, ~70
   39    97      > JMP                                                      ->100
   42    98    >   CONCAT                                           ~72     !9, '%29'
         99        ASSIGN_OP                                     8          !4, ~72
   44   100    >   ASSIGN_OP                                     8          !3, !4
   45   101        ASSIGN                                                   !4, ''
   17   102    > > JMP                                                      ->25
        103    >   FE_FREE                                                  $30
   16   104      > JMP                                                      ->22
        105    >   FE_FREE                                                  $27
   10   106      > JMP                                                      ->6
        107    >   FE_FREE                                                  $18
   51   108        ASSIGN_OP                                     8          !1, '%29'
   52   109        ASSIGN_OP                                     8          !2, '%29'
   54   110        ECHO                                                     !1
   55   111        ECHO                                                     !2
   56   112        ECHO                                                     !3
   57   113      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
236.22 ms | 1017 KiB | 16 Q