<?php
$GroupOfEight = array(array(5,5,5),array(0,1,3,2,4,5,7,6),array(4,5,6,7,16,12,13,14),array(12,13,15,14,8,9,11,10),array(2,6,14,10,3,7,15,11),array(1,3,5,7,13,15,9,11),array(0,4,12,8,1,5,13,9),array(0,1,3,2,8,9,11,10));
$myStack = array(0,1,3,2,4,1,2,3);
//
$myStack = array_unique($myStack);
$searchKeys = array();
foreach ( $GroupOfEight as $key => $values ) {
(count(array_intersect($values, $myStack)) == count($myStack)) and $searchKeys[] = $key;
}
// Output all keys it wound same match
var_dump($searchKeys);
// OR Output Each Array it found a match
foreach ( $searchKeys as $key ) {
var_dump($GroupOfEight[$key]);
}
?>