Looking fo possibility to detect if $string
is match all words in $array
.
Words order not known in advance (user typed text).
array(
'test',
'shmest',
'zest',
'fest',
'etcest'
);
I undertand that i can:
$is_match = true;
foreach ($array as $word) {
if (!strpos($string, $word) === false) {
$is_match = false;
break;
}
}
(Can|Should) i make somethin like above via preg_match[_all]?
EDIT1
Priority is less memory and fast work.
Tested 2 unswers and own above https://eval.in/144266 so my is fastest
And $string
can contain of any symbols