Bare så du kan komme i gang,
<?php
$outArr = array();
$arr1 = array(0 => array('ID' => '01', 'FIRSTNAME' => 'Google'));
$arr2 = array(0 => array('ID' => '01', 'FIRSTNAME' => 'JOHN', 'SURNAME' => 'DOE'),
1 => array('ID' => '01', 'FIRSTNAME' => 'NewJOHN', 'SURNAME' => 'NewDOE'));
foreach ($arr1 as $key => $compArr) {
$companyId = $compArr['ID'];
$outArr[$compArr['FIRSTNAME']] = '';
foreach ($arr2 as $arr2key => $employeeArr) {
if ($employeeArr['ID'] == $companyId) {
$outArr[$compArr['FIRSTNAME']][] .= $employeeArr['FIRSTNAME'];
}
}
}
echo json_encode($outArr);
exit;
?>