<?php $string = 'Some text bla-bla #date# other text #date# some other #date#'; echo preg_replace_callback('/#date#/', function () { return date('Y-m-d', strtotime( '+'.mt_rand(0,45).' days')); }, $string);
You have javascript disabled. You will not be able to edit any code.