Removing Duplicate Values from an Array in PHP


Use array_unique() to remove duplicate values from an array.

Source Code

$numbers = [1, 2, 2, 3, 4, 4, 5];
$unique = array_unique($numbers);
print_r($unique);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments