\s*?,Uims', $texte, $matches, PREG_SET_ORDER)) { $placeholder = ''; $items = array(); foreach ($matches as $match) { if (preg_match(',(.*),Uims', $match[0], $r)) { $items[strtotime($r[1])] = trim($match[0]); $texte = str_replace($match[0], unique($placeholder), $texte); } } krsort($items); $texte = str_replace($placeholder, implode("\n\t", $items) . "\n", $texte); } return $texte; }