This is the first array:
$possible_combinations = array(
1 => array(1),
2 => array(2),
3 => array(3),
4 => array(4),
5 => array(1, 2),
6 => array(1, 3),
7 => array(1, 4),
8 => array(2, 3),
9 => array(2, 4),
10 => array(3, 4),
11 => array(2, 3, 4),
12 => array(1, 3, 4),
13 => array(1, 2, 4),
14 => array(1, 2, 3),
15 => array(1, 2, 3, 4)
);
This is the second array:
$seeking = array(2, 3, 4);
As you can see $possible_combinations[11] matches $seeking.
The value of $seeking in this case is 2, 3, 4 but it may be different at other times. How can I run a check against the
$possible_combinations array to see if the $seeking array matches any of the values of that associative array.
It should return the key of the match if there is one.
You can use PHP’s built-in
array_search()function for this.http://www.php.net/manual/en/function.array-search.php