3v4l.org

run code in 300+ PHP versions simultaneously
<?php if ( !function_exists( 'mb_convert_encoding' ) ) { exit('[mbstring not loaded]'); } $oldSub = mb_substitute_character(); mb_substitute_character( 0xfffd ); $res = mb_convert_encoding( "\xf4\x90\x80\x80 \xc2", 'UTF-8', 'UTF-8' ); mb_substitute_character( $oldSub ); if ( $res === "\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd" ) { // mbstring follows best practices. $level = 3; } elseif ( $res[0] !== "\xef" ) { // mbstring is old; it treats values above U+10FFFF as valid. // This is the case for PHP 5.3. $level = 0; } elseif ( substr_compare( $res, " \xef\xbf\xbd", -4 ) !== 0 ) { // mbstring is affected by <https://bugs.php.net/bug.php?id=65045>. $level = 1; } else { // mbstring nevertheless doesn't follow best practices. (Perhaps this system // has an old version of ICU, and mbstring was changed to use it.) $level = 2; } echo $level;
Output for git.master, git.master_jit, rfc.property-hooks
3

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
45.1 ms | 401 KiB | 8 Q