How to remove duplicate values from a PHP Array?

Member

by sidney , in category: Technology , 4 years ago

How to remove duplicate values from a PHP Array?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by braeden , 4 years 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));
?>


Related Threads:

How to get length of an array in PHP ?
How can I remove index.php from URL in Codeigniter?
How to Use Php to Parse Json Data in 2025?
What Are the Key Features That Make Codeigniter Ideal for Rapid Php Application Development?
How To Delete Duplicate Rows From The Database Table?
What is difference Between PHP 5 and 7?