Array comparison problems

Source: Internet
Author: User
Array comparison problem This post was last edited by u012984377 from 2014-08-0811: 21: 42 to implement string & nbsp; off-road, City SUB & nbsp; (length16) comparison with wjc_title & nbsp; & gt; & nbsp; string & nbsp; 2 car & nbsp; (lengt array) in the array

This post was last edited by u012984377 at 11:21:42


Implementation string 'cross-country, city SUB' (length = 16)
Compare it with the 'WC _ title' => string '2-compartment car '(length = 13) in the array to see if the conditions are met,

How to do it? I just learned PHP soon.
------ Solution --------------------
Do not map, paste your array.
Which of the following conditions is met?
------ Solution --------------------
$ Ar1 = array ('A1', 'A2 ');
$ Ar2 = array (
Array ('WC _ id' => '12', 'WC _ title' => 'A1 '),
Array ('WC _ id' => '23', 'WC _ title' => 'sfdss '),
);

Function foo ($ item ){
Global $ value;
Return $ value = $ item ['wjc _ title'];
}
Foreach ($ ar1 as $ value ){
Echo $ value, '', array_filter ($ ar2, 'Foo ')? 'In': 'not', PHP_EOL;
}
A1 in
A2 is not present

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.