Created
August 6, 2021 19:35
-
-
Save graste/e57d71abd4d796d9bb32cf6de61569d9 to your computer and use it in GitHub Desktop.
PHP compare strings without diacritics
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// https://twitter.com/derickr/status/1423682080085626885?s=19 | |
$c = new Collator( 'en' ); | |
$c->setStrength( Collator::PRIMARY ); | |
if ( $c->compare( 'Séan', 'Sean' ) == 0 ) | |
{ | |
echo "The same\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment