3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo preg_replace( '#\[country ln=(.*?)\] | \[cn=(.*?)\](.*?)\[/cn\] | \[/country\] | ,\s*#Xxi', "(('$1')?'$1:<br />':'').(('$2')?'<img src=\"$2.png\" border=\"0\" alt=\"$3\" class=\"ui-icon-country\" />$3':'')", '[country ln=COUNTRIES][cn=us]USA[/cn], [cn=hu]Hungary[/cn], [cn=ru]Russia[/cn], [cn=gb]Great Britain[/cn][/country]' );
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
[country ln=COUNTRIES](('')?':<br />':'').(('us')?'<img src="us.png" border="0" alt="USA" class="ui-icon-country" />USA':'')(('')?':<br />':'').(('')?'<img src=".png" border="0" alt="" class="ui-icon-country" />':'')(('')?':<br />':'').(('hu')?'<img src="hu.png" border="0" alt="Hungary" class="ui-icon-country" />Hungary':'')(('')?':<br />':'').(('')?'<img src=".png" border="0" alt="" class="ui-icon-country" />':'')(('')?':<br />':'').(('ru')?'<img src="ru.png" border="0" alt="Russia" class="ui-icon-country" />Russia':'')(('')?':<br />':'').(('')?'<img src=".png" border="0" alt="" class="ui-icon-country" />':'')(('')?':<br />':'').(('gb')?'<img src="gb.png" border="0" alt="Great Britain" class="ui-icon-country" />Great Britain':'')(('')?':<br />':'').(('')?'<img src=".png" border="0" alt="" class="ui-icon-country" />':'')