3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mainArray = array ( 0 => array ( 'name' => 'bf_1040242[326]', 'value' => 'Just some Information. Additional Text', ), 1 => array ( 'name' => 'bf_1040242[17565][]', 'value' => '2', ), 2 => array ( 'name' => 'bf_1040242[17565][]', 'value' => '1', ), 3 => array ( 'name' => 'bf_1040242[17565][]', 'value' => '3', ), 4 => array ( 'name' => 'bf_1040242[other][17565]', 'value' => 'Testing', ), 5 => array ( 'name' => 'bf_1040242[597]', 'value' => '1', ), 6 => array ( 'name' => 'bf_1040242[327]', 'value' => 'This is some text', ), 7 => array ( 'name' => 'bf_1040242[328]', 'value' => 'asdasd', ), 8 => array ( 'name' => 'bf_1040242[11880]', 'value' => 'wwwww', ), 9 => array ( 'name' => 'bf_1040242[329]', 'value' => 'xxxxx', ), 10 => array ( 'name' => 'bf_1040242[28622]', 'value' => '2', ), 11 => array ( 'name' => 'bf_1040242[other][28623]', 'value' => '', ), 12 => array ( 'name' => 'bf_1040242[42283]', 'value' => '1', ), 13 => array ( 'name' => 'bf_1040242[42284][]', 'value' => '2', ), 14 => array ( 'name' => 'bf_1040242[42284][]', 'value' => '3', ), 15 => array ( 'name' => 'bf_1040242[42284][]', 'value' => '4', ), 16 => array ( 'name' => 'bf_1040242[other][42284]', 'value' => 'Something Else', ), ); function array_join($value, &$result) { if (!is_array($value)) { $result = $value; return; } foreach ($value as $k => $v) { array_join($v, $result[$k]); } } $result = []; foreach ($mainArray as $entry) { parse_str($entry['name'] . '=' . $entry['value'], $nameArray); array_join($nameArray, $result); } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/peDAI
function name:  (null)
number of ops:  22
compiled vars:  !0 = $mainArray, !1 = $result, !2 = $entry, !3 = $nameArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
  103     1        ASSIGN                                                   !1, <array>
  105     2      > FE_RESET_R                                       $6      !0, ->17
          3    > > FE_FETCH_R                                               $6, !2, ->17
  107     4    >   INIT_FCALL                                               'parse_str'
          5        FETCH_DIM_R                                      ~7      !2, 'name'
          6        CONCAT                                           ~8      ~7, '%3D'
          7        FETCH_DIM_R                                      ~9      !2, 'value'
          8        CONCAT                                           ~10     ~8, ~9
          9        SEND_VAL                                                 ~10
         10        SEND_REF                                                 !3
         11        DO_ICALL                                                 
  108    12        INIT_FCALL                                               'array_join'
         13        SEND_VAR                                                 !3
         14        SEND_REF                                                 !1
         15        DO_FCALL                                      0          
  105    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $6
  111    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function array_join:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/peDAI
function name:  array_join
number of ops:  19
compiled vars:  !0 = $value, !1 = $result, !2 = $v, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   91     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   92     2        TYPE_CHECK                                  128  ~4      !0
          3        BOOL_NOT                                         ~5      ~4
          4      > JMPZ                                                     ~5, ->7
   93     5    >   ASSIGN                                                   !1, !0
   95     6      > RETURN                                                   null
   98     7    > > FE_RESET_R                                       $7      !0, ->17
          8    > > FE_FETCH_R                                       ~8      $7, !2, ->17
          9    >   ASSIGN                                                   !3, ~8
   99    10        INIT_FCALL_BY_NAME                                       'array_join'
         11        SEND_VAR_EX                                              !2
         12        CHECK_FUNC_ARG                                           
         13        FETCH_DIM_FUNC_ARG                               $10     !1, !3
         14        SEND_FUNC_ARG                                            $10
         15        DO_FCALL                                      0          
   98    16      > JMP                                                      ->8
         17    >   FE_FREE                                                  $7
  101    18      > RETURN                                                   null

End of function array_join

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.1 ms | 1019 KiB | 16 Q