I hope you can help me, I have an array with some filter words:
$dang=array('foo','bar','baz','qux');
User can write a text, I am getting it in a variable:
$answ=$_GET[answ];
If user write a text like: "I like this cabaret, it's so foo.", I want to print this:
Found: bar
"bar" is found in "cabaret", (First ocurrence only).
I found this function here Find first occurance of array value in a string
$firstMatch = array_shift(array_intersect(str_word_count(strtolower($answ), 1), $dang));
it's works, sadly it finds words only (text separated by spaces).
Any way to do it for full text?
strpos()comes to mind