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 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.4.16, 8.5.0 - 8.5.1
<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>
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
104.22 ms | 411 KiB | 6 Q