<?php $rows = array ( 0 => array ( 'name' => 'Roger', 'id' => '1', ), 1 => array ( 'name' => 'David', 'id' => '2', ), 2 => array ( 'name' => 'David', 'id' => '2', ), ); $output = []; foreach ($rows as $row) { $output[$row['id']] = $row; } print_r($output);
You have javascript disabled. You will not be able to edit any code.