<?php $text = '[ time]Y-m-d[/time]'; $text = preg_replace("/\[time\](.*)\[\/time\]/ies","date('\\1')",$text); echo $text; ?>