How to merge two arrays of php into one array

$a= [
       ["id"=>1,"age"=>12],
       ["id"=>2,"age"=>13],
       ["id"=>3,"age"=>15]
];
$b= [
        ["id"=>1,"money"=>100],
        ["id"=>3,"money"=>400],  
        ["id"=>2,"money"=>200]
];

how to merge into an array according to id value matching to form this.

$c=[
       ["id"=>1,"age"=>12,"money"=>100],
       ["id"=>2,"age"=>13,"money"=>200],
       ["id"=>3,"age"=>15,"money"=>400] 
];  
Php
Apr.25,2021

$c = array_map ('array_merge',$a,$b);
print_r ($c);


    $a= [
           ['id'=>1,'age'=>12],
           ['id'=>2,'age'=>13],
           ['id'=>3,'age'=>15]
    ];

    $b= [
            ['id'=>1,'money'=>100],
            ['id'=>3,'money'=>400],
            ['id'=>2,'money'=>200]
    ];
    $res_id_a = array_column($a,null,'id');
    $res_id_b = array_column($b,null,'id');
    foreach($res_id_a as $key => &$val){
        $val['money'] = $res_id_b[$key]['money'];
    }
    var_dump($res_id_a);die();

$a = [
  ['id' => 1, 'age' => 12],
  ['id' => 2, 'age' => 13],
  ['id' => 3, 'age' => 15]
];

$b = [
  ['id' => 1, 'money' => 100],
  ['id' => 2, 'money' => 200],
  ['id' => 3, 'money' => 400],
];

$c = [];

foreach ($a as $_a) {
  $_c = $_a;
  foreach ($b as $_b) {
    if ($_a['id'] === $_b['id']) {
      $_c['money'] = $_b['money'];
    }
  }
  $c[] = $_c;
}

print_r($c);

consider array_map

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9edf0-4eedf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9edf0-4eedf.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?