I have a problem that I'm sure is easy to solve with PHP's inbuilt functions or with one or two lines of code, but I cant seem to find a solution using my limited experince.
I have a master array:
$master_array = ('location_1','location_2','location_3','location_4','location_5');
I get given an array:
$submitted_array = ('location_1','location_3');
And I need to compare both arrays to form an array such as this:
$locations = (0,2);
Where the numbers in the $locations array are the locations of the $submitted_array elements in the $master_array.
There must be a way of doing this without loops, surely.