PHP in_array or maching element's value in array

Posted on 2009-04-23
Last Modified: 2013-12-12
Hello, I'm trying to match element's value in array with in_array function as shown below.
It doesn't have to be in_array to acomplish this.
But, so far it doesn't work that I expected.
Please help.

Thank you.
$a = array("a", "b", "c");

$b = array("a", "z", "b",  "c", "d");

if (in_array($b, $a))

    echo "Found";

Actually, I need to acomplish:

"If ALL of $a array's elements found in array $b then reurn true."

Open in new window

Question by:eb110k
    LVL 6

    Accepted Solution


    Author Closing Comment

    Thank you for your quick response.
    I found a perfect solution in the article.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now