I just got some really strange problem.
Check it out:
$yourWord='http://mywebsite.com/combo-points-carmaboy-boys-sixer';
$URLW = "'kid', 'kids', 'boys', 'six'";
$targets = array($URLW);
$pattern = '/\b('.implode('|', $targets).')\b/';
if (preg_match($pattern, $yourWord, $matches)) {
echo 'FOUND!!';
} else {
echo 'NOT FOUND!';
}
In this way it's giving me result NOT FOUND! but when i do that
$targets = array('kid', 'kids', 'boys', 'six'); it's working.
So why it's not working on the way i make it in my code sample ?
And how i can use it with variable in the array ?
Thanks