I am using preg_split to split a string into words.
However, it is not working for a particular string that is fetched from a mysql text column.
If I manually assign the string to a variable it will work correctly but not when the string is fetched from the database.
Here is the simple code I am using:
//The failing string. When manually assigned like this it works correctly
$string = "<p><strong>Iden is lesz lehetoseg a foproba és a koncert napjan ebedet kerni a MUPA-ban. Ára 1000-1200 Ft körül várható. Azoknak, akik még nem jártak a MUPA-ban ingyenes bejarasi lehetoseget biztositunk. Tovabba segitunk a pesti szallas megszervezeseben is, ha igenyt tartotok ra.</strong></p>";
$string = strip_tags(trim($string));
$words = preg_split('/\PL+/u', $string, null, PREG_SPLIT_NO_EMPTY);
Here is what the preg_split returns when called on the string from the database:
array(1) { [0]=> string(269) "Iden is lesz lehetoseg a foproba és a koncert napjan ebedet kerni a MUPA-ban. Ára 1000-1200 Ft körül várható. Azoknak, akik még nem jártak a MUPA-ban ingyenes bejarasi lehetoseget biztositunk. Tovabba segitunk a pesti szallas megszervezeseben is, ha igenyt tartotok ra." }
Does anyone know what is causing preg_split to fail for this string?
Thanks