Array A:
486 987
Array B:
247-16-02-2009 486-16-02-2009 562-16-02-2009 1257-16-02-2009 486-16-02-2009
I want to search and list all Array A elements that matches in Array B. for example: 486-16-02-2009 (twice).
Array A:
486 987
Array B:
247-16-02-2009 486-16-02-2009 562-16-02-2009 1257-16-02-2009 486-16-02-2009
I want to search and list all Array A elements that matches in Array B. for example: 486-16-02-2009 (twice).
You could do something like this, however it's probably not as good as using php built-ins like array-intersect because we're entering loop-hell. If either array gets too big your script will slow to a crawl.
foreach ($arrB as $values) {
foreach ($arrA as $compare) {
if (substr($values, 0, strlen($compare)) == $compare) {
//do stuff
}
}
}