Home > Backend Development > PHP Tutorial > PHP efficiently removes duplicate values ​​from array_PHP tutorial

PHP efficiently removes duplicate values ​​from array_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 16:59:33
Original
876 people have browsed it

This article is a simple and efficient code for removing duplicate values ​​from a one-dimensional array. Friends in need can simply refer to it.

$a=array("a"=>"Cat","b"=>"Dog","c"=>"Cat");
print_r(array_unique($a));
?>
The code is as follows
 代码如下 复制代码

$a=array("a"=>"Cat","b"=>"Dog","c"=>"Cat");
print_r(array_unique($a));
?>

Array ( [a] => Cat [b] => Dog )

Copy code

Array ( [a] => Cat [b] => Dog )

As a result, we only kept one Cat. http://www.bkjia.com/PHPjc/631314.htmlwww.bkjia.com
true
http: //www.bkjia.com/PHPjc/631314.html
TechArticleThis article is a simple and efficient code for removing duplicate values ​​from a one-dimensional array. Friends in need can provide a simple reference. Just a moment. The code is as follows Copy the code ?php $a=array(a=Cat,b=Dog,c=Cat);...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template