Simple foreach loop should suffice. Consider this example:
$new_values = array();
$values = array( array('1393/03', 5666562, 5), array('1393/03', 491380, 6), array('1393/03', 4210423, 30), array('1393/03', 351000, 55), array('1393/03', 53000, 60), array('1393/02', 15799573, 5), array('1393/02', 1144313, 6), array('1393/02', 12131004, 30), array('1393/02', 39000, 55),);
foreach($values as $key => $value) {
$new_values[$value[0]]['Date'] = $value[0];
$new_values[$value[0]][$value[2]] = $value[1];
}
$new_values = array_values($new_values);
echo "<pre>";
print_r($new_values);
echo "</pre>";
solved PHP custom regroup array [closed]