Mega Code Archive

 
Categories / Php / Strings
 

Using Back References with preg_replace()

//converts dates in dd/mm/yy format to mm/dd/yy format: <? $test = "25/12/2000"; print preg_replace("|(\d+)/(\d+)/(\d+)|", "$2/$1/$3", $test); ?>