<?php
$arr = array
(
0 => array
(
'customer_name' => 'John Dow',
'customer_email' => 'john@example.com',
'customer_mobile' => '1236547895',
'birth_date' => '12/1/1996',
'status' => 'Enable'
),
1 => array
(
'customer_name' => 'Alex',
'customer_email' => 'jennifer@example.com',
'customer_mobile' => '4563214785',
'birth_date' => '19/1/1996',
'status' => 'Enable'
),
2 => array
(
'customer_name' => 'Arina',
'customer_email' => 'arina@example.com',
'customer_mobile' => '1236547895',
'birth_date' => '25/1/1996',
'status' => 'Enable'
),
3 => array
(
'customer_name' => 'Atom',
'customer_email' => 'atom@example.com',
'customer_mobile' => '5214789632',
'birth_date' => '12/1/1998',
'status' => 'Enable'
),
4 => array
(
'customer_name' => 'Jennifer',
'customer_email' => 'jennifer@example.com',
'customer_mobile' => '4563214785',
'birth_date' => '12/2/1996',
'status' => 'Enable'
)
);
$cm = array_column($arr, 'customer_mobile');
if($cm != array_unique($cm)){
echo 'There are duplicates in customer_mobile';
}
echo '<br>' . PHP_EOL;
$ce = array_column($arr, 'customer_email');
if($ce != array_unique($ce)){
echo 'There are duplicates in customer_email';
}
echo '<br>' . PHP_EOL;
if($cm != array_unique($cm) && $ce != array_unique($ce)){
echo 'There are duplicates in both customer_mobile and customer_email';
}
?>
preferences:
26.73 ms | 405 KiB | 5 Q