The data in the array has problems with the same value query,

Source: Internet
Author: User
Array internal data query problem, ask for help!
There are now three arrays of $data1=array (' 1,2,3,4,5,6 ', ' 1,2,3,4,5,7 ', ' 1,2,3,4,5,8 ', ' 1,2,3,4,5,9 ');
$data 2=array (1,3,5,7,11,13,15,17,19,21);
$data 3=array (3,6,9,12,15,18,21,24);

At the same time, the array $data1 already exists in the database HMK
The format is as follows:
L1 L2 L3 L4 L5 L6
1 2 3 4 5 6
1 2 3 4 5 7 ....

Now I want to add the field data2 Data3 in HMK to store the number of occurrences of each record in $data2, $data 3. Is there any good way?

Should you operate within an array and then store the results in a database or directly within the database? Please help me,!~~!

------Solution--------------------
PHP Code
  
  $value) {    $data 1[$key].= ', '. Count (Array_intersect (' Explode (', ', ' $value '), $data 2));    $data 1[$key].= ', '. Count (Array_intersect (Explode (', ', $value), $data 3));} Print_r ($data 1);
  • Related Article

    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.