<?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';
}
?>
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
- There are duplicates in customer_mobile<br>
There are duplicates in customer_email<br>
There are duplicates in both customer_mobile and customer_email
preferences:
133.37 ms | 404 KiB | 217 Q