3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = '{download} button {download="hello"} {download=\'hey\'} assa {download="asa"}'; $str = str_replace('{download}', '{download="Download"}', $str); $str = preg_replace( '/\{download(\=\"(.*)\"|\=\'(.*)\'|)\}/siU', '<a href="#" class="button">$2</a>', $str); echo $str; ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<a href="#" class="button">Download</a> button <a href="#" class="button">hello</a> <a href="#" class="button"></a> assa <a href="#" class="button">asa</a>