Array operation. I can't find a few functions, but I can't find them in the manual. so I 'd like to ask the experts who can help me solve this problem.

Source: Internet
Author: User
Array Operations, I will have a few functions, and I cannot find them in the manual. so I want to find a master who can help me to change it. & Lt ;? Php $ aarray (111,222,333,444,555,666,777); Unchanged $ a1array (aa, bb, cc, dd, ee, ff, gg); initial array $ a2array (a1a, bb, c array operation, I can't find a few functions and I can't find them in the manual, so I want to find someone who can help me.
$ A = array ('20160301', '20160301', '20160301', '20160301', '20160301', '20160301'); // unchanged
$ A1 = array ('A', 'BB ', 'CC', 'DD', 'ee', 'FF ', 'GG'); // initial array



$ A2 = array ('a1a ', 'BB', 'CC', 'd2d ', 'e3e', 'FF ', 'GG '); // a new array for a1 comparison
$ A3 = array_intersect_assoc ($ a1, $ a2); // compare two arrays, leaving the same; array ([1] => bb [2] => cc [5] => ff [6] => gg)
$ A4 = array ('1' => 'BBC ', '2' => 'CC', '5' => 'ff ', '6' => 'gg2'); // An Array for comparing a2.
$ A5 = array_intersect_assoc ($ a3, $ a4); // The result is Array ([2] => cc [5] => ff) // The Final same Array

//////// Want to use the a1-a5 to leave a different one? I don't know if there are any functions?


// If you want to leave a value different from the a1 value (a1a, d2d, e3e, bbc, gg2 ), at the same time, the $ a-$1 value corresponding to the key values of a1 is retained to form a unique array...
// What we want is the final requirement below? bytes
$ Gg = array ('1' => array ('20140901', 'AA', 'a1a '), '2' => array ('20160901', 'BB ', 'BBC '), '3' => array ('123', 'DD', 'd2d'), '4' => array ('123', 'ee ', 'e3e '), '5' => array ('000000', 'GG', 'gg2 '));




?>



------ Solution --------------------
Array_diff ()

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.