3v4l.org

run code in 300+ PHP versions simultaneously
<?php function format_text($string) { $string = preg_replace('/(\*\*(.*?)\*\*)/', '<b>\\2</b>', $string); $string = preg_replace('/(##(.*?)##)/', '<em>\\2</em>', $string); return $string; } $before = "Focus on the **user** and all else will ##follow##."; $after = format_text($before); echo $after;

preferences:
44.16 ms | 402 KiB | 5 Q