$date = '04.09.2002'; $date = preg_replace('/(\d{2}).(\d{2}).(\d{4})/', '\\3.\\2.\\1', $date); echo $date;
Output: 2002.09.04 Read up for more info. http://www.php.net/manual/en/ref.pcre.php regards alan Bård tommy nilsen wrote: > I want to sort text strings, but how could i do this ? > > Example: > > 04.09.2002 > 05.09.2002 > 19.03.1999 > > > Is there a way to "change" the string to something like this ... > > 2002.09.04 > 2002.09.05 > 1999.03.19 > > Or is there a better way to solve this ?? > > > Bård Tommy Nilsen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php