Skip to Content
Menu

in_array_any()

Checks an array for items from another array.

PHP July 13, 2017

Usage

PHP
nebula()->in_array_any($needles, $haystack)

Parameters

$needles
(Required) (Array) An array of elements to look for
Default: None

$haystack
(Required) (Array) An array of elements to search within
Default: None

Request or provide clarification »

Additional Notes

This function will return boolean. True if any of the needles are found, and false if none of them are.

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Utilities/Utilities.php on line 793.

    No Hooks

    This function does not have any filters or actions available. Request one?
    PHP
            public function in_array_any($needles, $haystack){
                if ( is_string($haystack) ){
                    $haystack = array($haystack); //Convert to an array if a string is provided
                }
    
                return (bool) array_intersect($needles, $haystack);
            }
    

    Override

    This function can not be short-circuited with an override filter. Request one?