3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('PINGTAGS', [ '#' => 'hashtag.php?hashtag', '@' => 'user.php?user' ]); function convert_text($str) { return preg_replace_callback( "~(?i)\bhttps?[-\w.\~:/?#[\]@!$&'()*+,;=]+|[@#](\w+)|U\+([A-F\d]{5})~", function($m) { // var_export($m); // see for yourself if (!isset($m[1])) { return sprintf('<a href="%s">%s</a>', $m[0], $m[0]); } if (!isset($m[2])) { return sprintf('<a href="%s=%s">%s</a>', PINGTAGS[$m[0][0]], $m[1], $m[0]); } return "<span class=\"emoji\">&#x{$m[2]};</span>"; }, $str); } echo convert_text( <<<STRING This is a @ping and a #hash. This is a www.example.com, this is http://example.com?asdf=1234#anchor https://www.example.net/a/b/c/?g=5&awesome=foobar# U+23232 http://www5.example.com https://sub.sub.www.example.org/ @pong@pug#tagged http://example.com/@dave more http://example.com/more_(than)_one_(parens) andU+98765more http://example.com/blah_(wikipedia)#cite-1 and more http://example.com/blah_(wikipedia)_blah#cite-1 and more http://example.com/(something)?after=parens STRING );
Output for git.master, git.master_jit, rfc.property-hooks
This is a <a href="user.php?user=ping">@ping</a> and a <a href="hashtag.php?hashtag=hash">#hash</a>. This is a www.example.com, this is <a href="http://example.com?asdf=1234#anchor">http://example.com?asdf=1234#anchor</a> <a href="https://www.example.net/a/b/c/?g=5&awesome=foobar#">https://www.example.net/a/b/c/?g=5&awesome=foobar#</a> <span class="emoji">&#x23232;</span> <a href="http://www5.example.com">http://www5.example.com</a> <a href="https://sub.sub.www.example.org/">https://sub.sub.www.example.org/</a> <a href="user.php?user=pong">@pong</a><a href="user.php?user=pug">@pug</a><a href="hashtag.php?hashtag=tagged">#tagged</a> <a href="http://example.com/@dave">http://example.com/@dave</a> more <a href="http://example.com/more_(than)_one_(parens)">http://example.com/more_(than)_one_(parens)</a> and<span class="emoji">&#x98765;</span>more <a href="http://example.com/blah_(wikipedia)#cite-1">http://example.com/blah_(wikipedia)#cite-1</a> and more <a href="http://example.com/blah_(wikipedia)_blah#cite-1">http://example.com/blah_(wikipedia)_blah#cite-1</a> and more <a href="http://example.com/(something)?after=parens">http://example.com/(something)?after=parens</a>

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:
29.75 ms | 409 KiB | 5 Q