3v4l.org

run code in 300+ PHP versions simultaneously
<?php $foo = "🚁- Tour @exslagermaurice"; function is_ascii( $str ) { return ( bool ) !preg_match( '/[\x80-\xFF]/' , $str ); } /** * utf8_single_chr_html_encode( ) * * Converts a UTF-8 character to HTML Numbered Entity like &#123; * @since 1.0 * * @param string $chr The Unicode character to be encoded as numbered entity * @return string HTML numbered entity */ function utf8_single_chr_html_encode( $chr ) { return '&#' . utf8_ord( $chr ) . ';'; } /** * utf8_html_encode( ) * * Converts a UTF-8 string to a series of * HTML Numbered Entities like &#123;&#39;&#1740;... * @since 1.0 * * @param string $str The Unicode string to be encoded as numbered entities * @return string HTML numbered entities */ function utf8_html_encode( $str ) { return implode( array_map( 'utf8_single_chr_html_encode' , mb_split( $str ) ) ); } var_dump(mb_detect_encoding($foo)); var_dump(utf8_html_encode($foo));
Output for git.master, git.master_jit, rfc.property-hooks
string(5) "UTF-8" Fatal error: Uncaught ArgumentCountError: mb_split() expects at least 2 arguments, 1 given in /in/pEQK6:36 Stack trace: #0 /in/pEQK6(36): mb_split('\xF0\x9F\x9A\x81- Tour @exs...') #1 /in/pEQK6(41): utf8_html_encode('\xF0\x9F\x9A\x81- Tour @exs...') #2 {main} thrown in /in/pEQK6 on line 36
Process exited with code 255.

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:
47.22 ms | 401 KiB | 8 Q