3v4l.org

run code in 300+ PHP versions simultaneously
<?php $crap = "\u200e\u206a\u200f\u200e\u202d\u206f\u200c\u206a\u202c\u202b\u200f\u206f\u202b\u206e\u206e\u202b\u206e\u202e\u206c\u202b\u206d\u200e\u202a\u206d\u200b\u206c\u206a\u202e\u206b\u200b\u200f\u200b\u202d\u202d\u206f\u206b\u200c\u206a\u206f\u206b\u202e"; function charset_decode_utf_8 ($string) { /* Only do the slow convert if there are 8-bit characters */ /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ if (!preg_match("/[\200-\237]/", $string) && !preg_match("/[\241-\377]/", $string) ) { return $string; } // decode three byte unicode characters $string = preg_replace("/([\340-\357])([\200-\277])([\200-\277])/e", "'&#'.((ord('\\1')-224)*4096 + (ord('\\2')-128)*64 + (ord('\\3')-128)).';'", $string ); // decode two byte unicode characters $string = preg_replace("/([\300-\337])([\200-\277])/e", "'&#'.((ord('\\1')-192)*64+(ord('\\2')-128)).';'", $string ); return $string; } $str = charset_decode_utf_8($crap); echo $str;
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
\u200e\u206a\u200f\u200e\u202d\u206f\u200c\u206a\u202c\u202b\u200f\u206f\u202b\u206e\u206e\u202b\u206e\u202e\u206c\u202b\u206d\u200e\u202a\u206d\u200b\u206c\u206a\u202e\u206b\u200b\u200f\u200b\u202d\u202d\u206f\u206b\u200c\u206a\u206f\u206b\u202e
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 \u200e\u206a\u200f\u200e\u202d\u206f\u200c\u206a\u202c\u202b\u200f\u206f\u202b\u206e\u206e\u202b\u206e\u202e\u206c\u202b\u206d\u200e\u202a\u206d\u200b\u206c\u206a\u202e\u206b\u200b\u200f\u200b\u202d\u202d\u206f\u206b\u200c\u206a\u206f\u206b\u202e

preferences:
202.05 ms | 402 KiB | 290 Q