1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

array_intersect if display all matches, and ones that do not match ?

Discussion in 'PHP' started by xbat, Mar 18, 2016.

  1. #1
    if (array_intersect($1,$2))
    {
    //the ones that match??? how would I show on the ones that match?
    } else
    {
    //the ones that do not match how do I show the ones that do not match?
    }

    I have tried return false and return true nothing.. i am not sure what I am doing incorrectly I have also tried if (!array_intersect($1,$2))
     
    Solved! View solution.
    xbat, Mar 18, 2016 IP
  2. #2
    $matches = array_intersect($array1, $array2);
    $nomatches = array_diff($array1, $array2);

    print_r($matches);
    print_r($nomatches);
     
    PoPSiCLe, Mar 18, 2016 IP
  3. xbat

    xbat Well-Known Member

    Messages:
    326
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    105
    #3
    fantastic
     
    xbat, Mar 21, 2016 IP