I'd like to use regular expression for replacing date format from string in PHP.
I have a string like this:
TEXT TEXT TEXT {POST_DATE,m/d/Y} TEXT TEXT TEXT
I want to replace all strings contain {POST_DATE,m/d/Y} by a date that get from a external function, such as date(), and with date format from the input string.
I already tried to use this code below and it just returned the format string:
$string = preg_replace('/\{POST_DATE,(.*)\}/',date('$1'),$template);
and I got the return string here:
TEXT TEXT TEXT m/d/Y TEXT TEXT TEXT
I am not sure where I was wrong and if there are many {POST_DATE,m/d/Y} string in text, so how can I replace all of them following the way above.
/emodifier, this has been DEPRECATED as of PHP 5.5