Skip to content

Instantly share code, notes, and snippets.

@tateren
Last active June 24, 2022 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tateren/eb4d56e893a5e6209bd739ef91deeab6 to your computer and use it in GitHub Desktop.
Save tateren/eb4d56e893a5e6209bd739ef91deeab6 to your computer and use it in GitHub Desktop.
異体字セレクタ除去するやつ
<?php
if (function_exists('remove_variation_selector')) {
function remove_variation_selector(string $string): string
{
return preg_replace("/[\u{FE00}-\u{FE0F}\u{E0100}-\u{E01EF}]/u", '', $string);
}
}

Usage

echo remove_variation_selector('竈門禰󠄀豆子'); // => 竈門禰豆子

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment