<?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);
You have javascript disabled. You will not be able to edit any code.