I am creating a call log for my application. I have 2 arrays – $customers
with the list of customers and $liveCalls
with the incoming call number.
I want to display all calls in the application replacing the number with the customer name if it present in db.
foreach ($liveCalls as $call) {
foreach ($customers as $customer) {
if ($call['caller_number'] == $customer['phone_number']) {
array_push($callList, array('id' => $customer['id'], 'caller' =>
$customer['phone_number']));
}
}
array_push($callList, array('id' => NULL, 'caller' => $call['caller_number']));
}
echo json_encode($customers);
Recognized by PHP Collective
1