3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "{download='text for button'} HAHA! {download='test'}"; preg_match_all("/{download='(.*?)'}/", $string, $matches, PREG_SET_ORDER); foreach ($matches as $val) { $string = str_replace("{download='" . $val[1] . "'}", "<a class=\"button\">" . $val[1] . "</a>", $string); } echo $string;

preferences:
44.78 ms | 402 KiB | 5 Q