I have two arrays, for example:
array1={1,2,3,4,5,6,7,8,9};
array2={4,6,9}
Is there any function so that I can determine that array2 fully exists in array1?
I know i can use the in_array() function in a loop but in cases where I will have large arrays with hundreds of elements so I am searching for a function.
Try:
The
array_intersect.phpfunction will return only elements of the second array that are present in all the other arguments (only the first array in this case). So, if the length of the intersection is equal to the lenght of the second array, the second array is fully contained by the first one.