3v4l.org

run code in 300+ PHP versions simultaneously
<?php function text2bbc($text){ $find = array( '~\[b\](.*?)\[/b\]~s', '~\[i\](.*?)\[/i\]~s', '~\[u\](.*?)\[/u\]~s', '~\[size=(.*?)\](.*?)\[/size\]~s', '~\[color=(.*?)\](.*?)\[/color\]~s' ); $replace = array( '<b>$1</b>', '<i>$1</i>', '<span style="text-decoration:underline;">$1</span>', '<span style="font-size:$1px;">$2</span>', '<span style="color:$1;">$2</span>' ); return preg_replace($find,$replace,$text); } echo text2bbc('this is some [b]bold text[/b] and this is [color=#FF0000]Red text[/color]'); echo'<br>'; echo text2bbc('this text is [i]italic[/i] and this is not'); echo'<br>'; echo text2bbc('here we have [u]underlined[/u] text'); echo'<br>'; echo text2bbc('this is [size=24]24px[/size] font'); ?>
Output for git.master, git.master_jit, rfc.property-hooks
this is some <b>bold text</b> and this is <span style="color:#FF0000;">Red text</span><br>this text is <i>italic</i> and this is not<br>here we have <span style="text-decoration:underline;">underlined</span> text<br>this is <span style="font-size:24px;">24px</span> font

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