note 39007 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: Frank Sträter 

----

I forgot ta add $value === $needle instead of $value == $needle. The first one does a strict check. Thanks to the note by michi I have reduced the function to:

<?php

function in_array_multi($needle, $haystack) {
	if (!is_array($haystack)) return false;
    while (list($key, $value) = each($haystack)) {
        if (is_array($value) && in_array_multi($needle, $value) || $value === $needle) {
            return true;
		}
    }
    return false;
}

?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.