3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replace4byte($string) { return preg_replace('%(?: \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )%xs', '', $string); } echo replace4byte(\u2019);

preferences:
45.7 ms | 402 KiB | 5 Q