Home > Backend Development > PHP Tutorial > php array_unique example of removing duplicate values ​​from a one-dimensional array

php array_unique example of removing duplicate values ​​from a one-dimensional array

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-25 09:04:35
Original
1299 people have browsed it
  1. /**
  2. * Remove duplicate elements from the array
  3. * link: bbs.it-home.org
  4. * date: 2013/2/25
  5. */
  6. $input = array ("1" => "Apple", "Orange", "Yali", "a" => " Orange", "Banana", "Apple") ;
  7. $result = array_unique ( $input ) ;
  8. print_r ( $result ) ;
  9. ?>
Copy the code

Output result: array ( [1] => apple [2] => orange [3] => pear [4] => banana )



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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template