3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<INI_ISH [chorus] And all will surely agree, There's nothing like PHP. [1] It may not be the best way, But it isn't going away. [2] When you don't appear to hack it, Check for a closing bracket. [bridge] Oh, if you don't like this ode, Then please don't look at my code. INI_ISH; preg_match_all( '#^\[([^\]])[^\]]*\]\R\K(?:(?!^\[).)*$#ms', $content, $m ); $map = array_combine($m[1], $m[0]); $map[','] = "\n\n"; $sequence = '1,c,2,c,b,1,c'; echo strtr($sequence, $map);
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
It may not be the best way, But it isn't going away. And all will surely agree, There's nothing like PHP. When you don't appear to hack it, Check for a closing bracket. And all will surely agree, There's nothing like PHP. Oh, if you don't like this ode, Then please don't look at my code. It may not be the best way, But it isn't going away. And all will surely agree, There's nothing like PHP.

preferences:
60.4 ms | 407 KiB | 5 Q