3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bbcodes = [ '[URL]www.no.http.example.com[/URL]', '[url]https://any.com/any[/url]', '[url="nourl"]nourl[/url]', '[URL="https://any.com/any?any=333"]text text[/URL]', '[url="http://www.emptyTEXT.com"][/url]', '[url]http://www.any.com/any?any=44#sss[/url]', '[url="https://conflictinglink"]http://differenturl[/url]' ]; foreach ($bbcodes as $bbcode) { echo preg_replace('~\[url(?|]((https?://[^[]+))|(?:="(https?://[^"]+)")](.+?))\[/url]~i', '<a href=\"$1\">$2</a>', $bbcode); echo "\n---\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
[URL]www.no.http.example.com[/URL] --- <a href=\"https://any.com/any\">https://any.com/any</a> --- [url="nourl"]nourl[/url] --- <a href=\"https://any.com/any?any=333\">text text</a> --- [url="http://www.emptyTEXT.com"][/url] --- <a href=\"http://www.any.com/any?any=44#sss\">http://www.any.com/any?any=44#sss</a> --- <a href=\"https://conflictinglink\">http://differenturl</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:
296.9 ms | 406 KiB | 5 Q