How to correctly implement PHP delete array repeating elements _php tutorial

Source: Internet
Author: User
We are actually operatingThe sample code for the PHP delete array repeating element is as follows:

 
  1. function Uniquearray ($array)
  2. {
  3. Get unique ELTs as keys in Assoc. Array
  4. For ($i=0, $n=count ($array, 1); $i<$n; $i + +)
  5. $u _array[$array [$i]] = 1;
  6. Copy keys only to another array
  7. Reset ($u _array, 1);
  8. For ($i=0, $n=count ($u _array, 1); $i<$n; $i + +) {
  9. $unduplicated _array[] = key ($u _array, 1);
  10. Next ($u _array, 1);
  11. }
  12. return $unduplicated _array;
  13. }
  14. ?>

The above code is the implementation of PHP to delete duplicate elements of the array.


http://www.bkjia.com/PHPjc/446339.html www.bkjia.com true http://www.bkjia.com/PHPjc/446339.html techarticle we are actually working with PHP to delete the array repeating elements sample code as follows:? function Uniquearray ($array) {//getuniqueeltsaskeysinassoc.array for ($ i = 0, $ n = coun T ($array, 1); $i $n ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.