Array in Array

A Simple function see if an array is contained within another array

function array_in_array($needle, $haystack) {
	if(count($haystack) > 0) {
		foreach ($haystack as $key => $value) {
			if ($needle == $value)
				return true;
	return false;


Pass the array you want to check for and the array you want to search for it in as $needle and $haystack respectively


Add your comment