3v4l.org

run code in 300+ PHP versions simultaneously
<?php function iterate_combined(array $data) { if (!$data) { return []; } $fields = array_keys($data); $n = count(reset($data)); for ($i = 0; $i < $n; ++$i) { $row = []; foreach ($fields as $field) { $row[$field] = $data[$field][$i]; } yield $row; } } $data = [ 'id' => [1, 2, 3], 'title' => ['Первый', 'Впервые мы смогли', 'Перваши'], 'date' => ['2020-11-05 12:51:02', '2020-11-05 15:26:09', '2020-11-03 15:27:26'], 'rating' => [1000, 1212, 111111], 'size' => ['1000 MB', '441 GB', '132 mb'], 'views' => [56252, 1111, 1231] ]; foreach (iterate_combined($data) as $row) { echo json_encode($row, JSON_UNESCAPED_UNICODE), PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/X9ONY
function name:  (null)
number of ops:  15
compiled vars:  !0 = $data, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   27     1        INIT_FCALL                                               'iterate_combined'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4      > FE_RESET_R                                       $4      $3, ->13
          5    > > FE_FETCH_R                                               $4, !1, ->13
   28     6    >   INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 256
          9        DO_ICALL                                         $5      
         10        ECHO                                                     $5
         11        ECHO                                                     '%0A'
   27    12      > JMP                                                      ->5
         13    >   FE_FREE                                                  $4
   29    14      > RETURN                                                   1

Function iterate_combined:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 24
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 16
Branch analysis from position: 29
Branch analysis from position: 16
Branch analysis from position: 24
filename:       /in/X9ONY
function name:  iterate_combined
number of ops:  30
compiled vars:  !0 = $data, !1 = $fields, !2 = $n, !3 = $i, !4 = $row, !5 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2        BOOL_NOT                                         ~6      !0
          3      > JMPZ                                                     ~6, ->5
    5     4    > > GENERATOR_RETURN                                         
    7     5    >   INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !1, $7
    8     9        INIT_FCALL                                               'reset'
         10        SEND_REF                                                 !0
         11        DO_ICALL                                         $9      
         12        COUNT                                            ~10     $9
         13        ASSIGN                                                   !2, ~10
    9    14        ASSIGN                                                   !3, 0
         15      > JMP                                                      ->27
   10    16    >   ASSIGN                                                   !4, <array>
   11    17      > FE_RESET_R                                       $14     !1, ->24
         18    > > FE_FETCH_R                                               $14, !5, ->24
   12    19    >   FETCH_DIM_R                                      ~16     !0, !5
         20        FETCH_DIM_R                                      ~17     ~16, !3
         21        ASSIGN_DIM                                               !4, !5
         22        OP_DATA                                                  ~17
   11    23      > JMP                                                      ->18
         24    >   FE_FREE                                                  $14
   14    25        YIELD                                                    !4
    9    26        PRE_INC                                                  !3
         27    >   IS_SMALLER                                               !3, !2
         28      > JMPNZ                                                    ~20, ->16
   16    29    > > GENERATOR_RETURN                                         

End of function iterate_combined

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.21 ms | 1403 KiB | 20 Q