PHP E Modifier Treats Replacement String In Preg_Replace() As If It Were Php. – String Function

<?
function convDate( $month, $day, $year ) {
  $year = ($year < 70 )?$year+2000:$year;
  $time = ( mktime( 0,0,0,$month,$day,$year) );
  return date("l d F Y", $time);
}$dates = "3/18/03<br />\n7/22/04";
$dates = preg_replace( "/([0-9]+)\/([0-9]+)\/([0-9]+)/e","convDate($1,$2,$3)", $dates);
print $dates;
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.