How to remove duplicate values from a PHP Array?

Member

sidney

by sidney , in category: Technology , a month ago

How to remove duplicate values from a PHP Array?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by braeden , a month ago

You can use library function array_unique() for removing duplicated values for an array. Here is syntax to use it.

1
2
3
4
<?php
	$a=array("a"=>"home","b"=>"town","c"=>"town","php");
	print_r(array_unique($a));
?>