3v4l.org

run code in 300+ PHP versions simultaneously
<?php $db_rows = [ ['id' => 1, 'title' => 'test', 'number' => 2, 'desc' => 'test'], ['id' => 2, 'title' => 'test2', 'number' => 3, 'desc' => 'test2'], ['id' => 3, 'title' => 'test3', 'number' => 1, 'desc' => 'test3'], ]; $clone_db_rows = []; foreach( $db_rows as $key => $value ) { $clone_db_rows = array_merge( $clone_db_rows, // Merge the current array with... array_fill( // ...a newly created containing... 0, $value['number'], // ... X items equals to... $value // ... $value. ) ); } print_r($clone_db_rows);
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/PXeM9
function name:  (null)
number of ops:  22
compiled vars:  !0 = $db_rows, !1 = $clone_db_rows, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $6      !0, ->17
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->17
          4    >   ASSIGN                                                   !3, ~7
   13     5        INIT_FCALL                                               'array_merge'
   14     6        SEND_VAR                                                 !1
   15     7        INIT_FCALL                                               'array_fill'
   16     8        SEND_VAL                                                 0
   17     9        FETCH_DIM_R                                      ~9      !2, 'number'
         10        SEND_VAL                                                 ~9
   18    11        SEND_VAR                                                 !2
   15    12        DO_ICALL                                         $10     
   18    13        SEND_VAR                                                 $10
   13    14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !1, $11
   11    16      > JMP                                                      ->3
         17    >   FE_FREE                                                  $6
   23    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.86 ms | 1004 KiB | 16 Q