fork download
  1. <?php
  2.  
  3. $str = 'Давайте устроим встречу 20.05.2029 и потом ещё одну 09.06.2022';
  4.  
  5. $n = preg_match_all('/\d{2}\.\d{2}.\d{4}/', $str, $matches);
  6.  
  7. $new = [];
  8.  
  9. foreach ($matches as $date => $values) {
  10. foreach ($values as $key => $value) {
  11. $new[] = $value.' '.date("D", strtotime($value));
  12. }
  13. }
  14.  
  15. str_replace($matches, $new, $str);
  16. echo $str;
  17.  
Success #stdin #stdout #stderr 0.01s 82752KB
stdin
Standard input is empty
stdout
Давайте устроим встречу 20.05.2029 и потом ещё одну 09.06.2022
stderr
PHP Notice:  Array to string conversion in /home/m29m29/prog.php on line 15