Kathmandu,Nepal
Kathmandu,Nepal

Remove Duplicate Values from Array in PHP

To Remove Duplicate Values from Array in php,we use pre-define function array_unique that can help to remove duplicate values from Array.

Through array_unique() function, we can get only unique value from array.

<?php
$array = [11, 34, 56, 78, 34, 11, 23];
$newarray= array_unique($array );
print_r($newarray);
?>

Output:
Array
(
[0] => 11
[1] => 34
[2] => 56
[3] => 78
[6] => 23

)

Leave a Comment

Your email address will not be published. Required fields are marked *

×