Jump to content

in_array utf8 comparison


Reignite

Recommended Posts

Hi everyone! Here goes my first question:

 

how can i combine different characters as the same word in the function in_array() ?

 

for example i have the three words:

 

- "manoseṭṭhā"

- "manoseṭthā"

- "manoseṭṭha"

 

and in my array ($somearray) is the following word: manosettha

 

then i want for every in_array check for each of the above three words, to match the one allready present in the array (manosettha).

 

 

Anyone got a suggestion?

 

Thanks! much appreciated!

Link to comment
https://forums.phpfreaks.com/topic/204223-in_array-utf8-comparison/
Share on other sites

Finally, after lots of searching, here is a solution from php.net:

 

//When doing transliteration, you have to make sure that your LC_COLLATE is properly set, otherwise the default POSIX will be used.

//To transform "rené" into "rene" we could use the following code snippet:

<?php

setlocale(LC_CTYPE, 'nl_BE.utf8');

$string = 'rené';
$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);

echo $string; // outputs rene

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.