3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ [ 'Standort' => '', 'Letzte Meldung' => '', 'On-/Offline seit' => '04.05.2022 11:03', 'Online' => '', ], [ 'Standort' => 'Schweiz', 'Letzte Meldung' => '', 'On-/Offline seit' => '11.02.2022 14:59', 'Online' => '', ] ]; $columns = []; foreach ($input[0] as $columnName => $value) { $columnData = array_column($input, $columnName); if (strlen(implode($columnData))) { $columns[$columnName] = $columnData; } } $result = []; foreach ($columns as $colName => $colValues) { foreach ($colValues as $i => $value) { $result[$i][$colName] = $value; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 19
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 33
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 31
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 19
filename:       /in/L9liR
function name:  (null)
number of ops:  38
compiled vars:  !0 = $input, !1 = $columns, !2 = $value, !3 = $columnName, !4 = $columnData, !5 = $result, !6 = $colValues, !7 = $colName, !8 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   19     2        FETCH_DIM_R                                      ~11     !0, 0
          3      > FE_RESET_R                                       $12     ~11, ->19
          4    > > FE_FETCH_R                                       ~13     $12, !2, ->19
          5    >   ASSIGN                                                   !3, ~13
   20     6        INIT_FCALL                                               'array_column'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !3
          9        DO_ICALL                                         $15     
         10        ASSIGN                                                   !4, $15
   21    11        INIT_FCALL                                               'implode'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $17     
         14        STRLEN                                           ~18     $17
         15      > JMPZ                                                     ~18, ->18
   22    16    >   ASSIGN_DIM                                               !1, !3
         17        OP_DATA                                                  !4
   19    18    > > JMP                                                      ->4
         19    >   FE_FREE                                                  $12
   25    20        ASSIGN                                                   !5, <array>
   26    21      > FE_RESET_R                                       $21     !1, ->33
         22    > > FE_FETCH_R                                       ~22     $21, !6, ->33
         23    >   ASSIGN                                                   !7, ~22
   27    24      > FE_RESET_R                                       $24     !6, ->31
         25    > > FE_FETCH_R                                       ~25     $24, !2, ->31
         26    >   ASSIGN                                                   !8, ~25
   28    27        FETCH_DIM_W                                      $27     !5, !8
         28        ASSIGN_DIM                                               $27, !7
         29        OP_DATA                                                  !2
   27    30      > JMP                                                      ->25
         31    >   FE_FREE                                                  $24
   26    32      > JMP                                                      ->22
         33    >   FE_FREE                                                  $21
   31    34        INIT_FCALL                                               'var_export'
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.92 ms | 1088 KiB | 16 Q