Use this: echo preg_replace('#(\d{2})/(\d{2})/(\d{4})#' , "\\3-\\2-\\1", '24/07/2013' ); RESULT => 2013-07-24 Alejandro M.S -----Mensagem original----- De: Jim Giner [mailto:jim.giner@xxxxxxxxxxxxxxxxxx] Enviada em: sexta-feira, 26 de julho de 2013 11:12 Para: php-general@xxxxxxxxxxxxx Assunto: Re: From 24/7/2013 to 2013-07-24 On 7/26/2013 10:10 AM, Jim Giner wrote: > I think you should change from using 'rsort' ( a SORT function) to > 'array_reverse', a simple reverse function. > Your example of what you desire is wrong. > 24-7-2013 will give you the 2013-24-7 that you want. oops. I meant to say "will NOT give you the 2013-2407 that you want". -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php