Processing of php two-digit array

$a = array (

)
0 => array("id" => 4521, "name" => ""),
1 => array("id" => 4345, "name" => ""),
2 => array("id" => 4345, "name" => ""),

);
$b = array (

)
0 => array("code" => "010", "name" => ""),
1 => array("code" => "021", "name" => ""),
2 => array("code" => "010", "name" => ""),

);

final answer:
id name code
4345 Shanghai 021
4521 Beijing

write a piece of code that displays the above two arrays in the following form, sorted by id from smallest to largest, and Filter removes the duplicate value of name

Php
Feb.28,2021

<?php
$a = array(
    3 => array('id' => 4521, 'name' => ''),
    1 => array('id' => 4345, 'name' => ''),
    2 => array('id' => 4345, 'name' => ''),
);
$b = array(

    0 => array('code' => '010', 'name' => ''),
    1 => array('code' => '021', 'name' => ''),
    2 => array('code' => '010', 'name' => ''),
);

$id = array_column($a,'id');
//
asort($id);
//
$ids = array_unique($id);
//
foreach ($ids as $k=>$v){
    foreach ($a as $vn){
        if ($v == $vn['id']){
            $ret[$k] = $vn;
        }
    }
    $names = array();
    foreach ($b as $vc){
        if ($ret[$k]['name'] == $vc['name'] && !in_array($vc['name'],$names)){
            $names [] = $vc['name'];
            $ret[$k]['code'] = $vc['code'];
        }
    }}
var_dump($ret);
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-1b3b77a-e7e6.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-1b3b77a-e7e6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?