note 105490 modified in function.preg-replace by danbrown
| From: | danbrown@php.net | Date: | Mon, 22 Aug 2011 16:04:16 +0000 |
| Subject: | note 105490 modified in function.preg-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182652@lists.php.net to get a copy of this message | ||
I wrote some useful function to display date format based on date function particular string.
preg_replace function really help me to write this tiny code
<?php
function mysql2formatDate($strn,$outformat='n/j/Y'){
return
preg_replace("/(\d{4})-(\d{2})-(\d{2})/e","Date('$outformat',strtotime('$0'))",$strn);
}
?>
--was--
I wrote some useful function to display date format based on date function particular string.
preg_replace function really help me to write this tiny code
function mysql2formatDate($strn,$outformat='n/j/Y'){
return
preg_replace("/(\d{4})-(\d{2})-(\d{2})/e","Date('$outformat',strtotime('$0'))",$strn);
}
http://php.net/manual/en/function.preg-replace.php