For example:
main array is: array(0 => 'A', 1 => 'A', 2 => 'B', 3 => 'B', 4 => 'B');
pattern is: array('A', 'B');
expected answer: array( array(0, 2), array(1, 3) )
one more example:
main array array(0 => 'F', 5 => 'G', 78 => 'R', 2 => 'D');
pattern array('G', 'R', 'F');
expected answer: array(array(5, 78, 0))
How can I find all occurrences of pattern in array?
array(0, 2)andarray(1, 3)mean?array(0, 2). The0is the index ofAin the pattern array. and2is the number ofAs in the main array?array(0, 2)the0is the index ofAin the main array, and2is the index ofBin the main array