2008/09/04

PHP - Array In Array Function

This is simply a function in PHP to check if all rows from array1 exist in array2. I needed this function some time ago, thought I'll post it to save others the trouble of making it.

function array_in_array($array1,$array2) {
$result=array_intersect($array1,$array2);
if ($result==$array1) {return 1;}
else {return 0;}
}


If array1 exists in array2 --> returns TRUE.

No comments: