Php array-related question how to determine the different data of two arrays and output

Source: Internet
Author: User
How to determine the different data of two arrays in the php array problem, and the output is as follows: assume there are two arrays $ a = array ); and $ B = array (, 9); ask how to explain the two arrays of different data output I use the for loop only outputs the same but the output is different, ask how to implement, two arrays have different data outputs, that is, how to determine the different data of the two arrays and output the non-intersection php array problem
Assume that there are two arrays.
$ A = array );
And
$ B = array (1, 3, 5, 7, 9 );
How can I explain the different data outputs of two arrays?
I use the for loop to output the same
But if the output is different, ask how to implement it.

------ Solution --------------------
Two arrays have different data outputs, that is, non-intersection?

PHP code
$ A = array (, 9, 0); $ B = array (, 9); $ out1 = array_diff ($ a, $ B ); $ out2 = array_diff ($ B, $ a); $ out3 = array_merge ($ out1, $ out2); foreach ($ out3 as $ rs3) {echo $ rs3 .''; // 2 4 6 8 0}

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.