3v4l.org

run code in 500+ PHP versions simultaneously
<?php /* Two identical strings: "®" (c2 ae). They are built at runtime because literals cannot get the flag. */ $plain = implode('', ["\xC2", "\xAE"]); $flagged = implode('', ["\xC2", "\xAE"]); var_dump(bin2hex(mb_str_split($plain)[0])); /* Marks $flagged as valid UTF-8 without changing its bytes */ mb_check_encoding($flagged, 'UTF-8'); /* DOCOMO writes "®" as ee 9c b6 */ var_dump(bin2hex(mb_substr($plain, 0, 1, 'UTF-8-Mobile#DOCOMO'))); var_dump(bin2hex(mb_substr($flagged, 0, 1, 'UTF-8-Mobile#DOCOMO'))); ?>

preferences:
22.09 ms | 478 KiB | 4 Q