For a news script I want to recognize the content the user filled in about artists. So if they mention an artist I want to put this in an external database and when somebody views the article they can see the related artists that comes with the article they're reading. But I'm having a sort of creativity problem which holds me back. I use a explode function to seperate the words:
function multiexplode ($delimiters,$string) {
$ready = str_replace($delimiters, $delimiters[0], $string);
$launch = explode($delimiters[0], $ready);
return $launch;
}
$pieces = multiexplode(array(",",".","|",":","<",">"," "), $_POST['article_content']);
So if I have mentioned the artist Afrojack for example I can find it back in the $pieces array. Works well but found a problem. If for instance the user mentioned Nicky Romero, the artist is spread over two arrays and I can't possibly find it in my database filled with artists. So I thought of looking through two words, three words and everything but there has to be simple way I think. So my question is, how do I fix the problem that the script can only find oneword artists.