3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tagWrap(string $tag, string $txt = '', ?callable $func = null): string { $txt = $func ? $func($txt) : $txt; if (!strlen($txt)) { return ''; } return sprintf('<%1$s>%2$s</%1$s>', $tag, $txt); } function underline($txt) { return "<u>$txt</u>"; } echo tagWrap('b', 'make me bold') . "\n"; echo tagWrap('b') . "\n"; echo tagWrap('b', func: fn() => 'sneak this text in') . "\n"; echo tagWrap('i', 'underline me too', "underline") . "\n"; echo tagWrap('i', 'encode \'me\'', "htmlentities") . "\n"; echo tagWrap('i', 'make me italic and quote me', fn($txt) => "&quot;$txt&quot;");
Output for git.master, git.master_jit, rfc.property-hooks
<b>make me bold</b> <b>sneak this text in</b> <i><u>underline me too</u></i> <i>encode &#039;me&#039;</i> <i>&quot;make me italic and quote me&quot;</i>

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:
35.65 ms | 405 KiB | 5 Q