1 2 3 4 5 6
<?php $str = 'This is a *random* text, with some *bold* markup'; $bold_str = preg_replace('/\*(.*?)\*/','<strong>\\1</strong>',$str); echo $bold_str;
1
This is a <strong>random</strong> text, with some <strong>bold</strong> markup