3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $result = "°Freen\x18 ew°\x90ɮ\xc2"; $result = preg_replace('~[\x{0000}-\x{001F}\x{007F}-\x{00a0}]~', '', $result); //reject overly long 2 byte sequences, as well as characters above U+10000 and replace with ? $result= preg_replace( '/[\xC2-\xDF]((?![\x80-\xBF])|[\x80-\xBF]{2,})/S', '', $result ); echo $result;
Output for 4.4.3 - 4.4.9, 5.1.3 - 7.1.0
°Freen ew°ɮ
Output for 4.3.11 - 4.4.2, 5.0.0 - 5.1.2
Warning: preg_replace(): Compilation failed: range out of order in character class at offset 11 in /in/vrsXn on line 5
Output for 4.3.0 - 4.3.10
Warning: Compilation failed: range out of order in character class at offset 11 in /in/vrsXn on line 5