Skip to content

Instantly share code, notes, and snippets.

@graste
Created August 6, 2021 19:35
Show Gist options
  • Save graste/e57d71abd4d796d9bb32cf6de61569d9 to your computer and use it in GitHub Desktop.
Save graste/e57d71abd4d796d9bb32cf6de61569d9 to your computer and use it in GitHub Desktop.
PHP compare strings without diacritics
<?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