I'm making a filter function, and I was wondering if there is a way to do the following comparison:
The user wants to see some tests, and each of these tests has an array of 0/1, the user only needs to see tests with array equal to the once they made. Just for info 0=passed and `1=Failed.
The array made my user
array(12) { [0]=> string(1) "0" [1]=> string(1) "0" [2]=> string(1) "0" [3]=> string(1) "0" [4]=> string(1) "0" [5]=> string(1) "0" [6]=> string(1) "0" [7]=> string(1) "0" [8]=> string(1) "0" [9]=> string(1) "0" [10]=> string(1) "1" [11]=> string(1) "1" }
Random test array to compare with
array(30) { [0]=> string(6) "passed" [1]=> string(6) "passed" [2]=> string(6) "passed" [3]=> string(6) "passed" [4]=> string(6) "passed" [5]=> string(6) "passed" [6]=> string(6) "passed" [7]=> string(6) "passed" [8]=> string(6) "passed" [9]=> string(6) "passed" [10]=> string(6) "passed" [11]=> string(6) "passed" [12]=> string(6) "passed" [13]=> string(6) "passed" [14]=> string(6) "passed" [15]=> string(6) "passed" [16]=> string(6) "passed" [17]=> string(6) "passed" [18]=> string(6) "passed" [19]=> string(6) "passed" [20]=> string(6) "passed" [21]=> string(6) "passed" [22]=> string(6) "passed" [23]=> string(6) "passed" [24]=> string(6) "passed" [25]=> string(6) "passed" [26]=> string(6) "passed" [27]=> string(6) "passed" [28]=> string(6) "passed" [29]=> string(6) "passed" }
The users array is 12 long, and then I was wondering if you could take this array and see if it appears in the large array(30). Lets say the first 0-11 places in the large array is equal to the users, then it doesn't check, and goes on to the nest test.
Not working code example:
for($i = 0; $i < sizeof($LargeArray; $i++)
{
if($LargeArray['test'.$i][$i] == $UserArray)
{
echo"$LargeArray['test'.$i]";
echo"is equal to users array.";
exit(); //should stop checking this test1 and go check test2
}
}
How can i check if users array(12) is equal to the first 0-11 in largeArray()? and if not then 1-12.... 18-30.