Hi all
I have a very strange situation here...
I try to make a string search for a term in utf-8. My search term is "Den lille fløyten"
if i use this code:
$string = "Den Lille Fløyten"; // The string to search $phrase = "Den lille fløyten"; // The term to search $phrase = preg_replace('/\s+/', '\s+', preg_quote($phrase)); $p = '/\b' . $phrase . '\b/ui'; $result = preg_match($p, $string); // This gives me true (1)
everything is OK!
But if i put my search term in an array (which i have to do...) and then try to do the search using this search term as an array element i always get false result:
$SearchTerms=array('Høstnatt på Fjellskogen', 'Langt Innpå Skoga', 'Den lille fløyten', 'Sølv'); // my array with search terms $string = "Den Lille Fløyten"; // The string to search $phrase = $SearchTerms[2] // The term to search as part of an array $phrase = preg_replace('/\s+/', '\s+', preg_quote($phrase)); $p = '/\b' . $phrase . '\b/ui'; $result = preg_match($p, $string); // This gives me FALSE (0)!!!!!!!
Any Ideas?
Thanks in advance.