<?php
$str = 'Давайте устроим встречу 20.05.2022 и потом ещё одну 12.06.2022';
// ЗДЕСЬ НУЖЕН КОД
echo $str;
// Давайте устроим встречу 20.05.2022 (пт) и потом ещё одну 12.06.2022 (вс)
<?php
$str = 'Давайте устроим встречу 20.05.2022 и потом ещё одну 12.06.2022';
$str = preg_replace_callback("#(0[1-9]|[12][0-9]|3[01]).(0[1-9]|1[0-2]).(\d{4})#m", function ($matches) {
return sprintf("%s [%s]", $matches[0], date('l', strtotime($matches[0])));
}, $str);
echo $str;
<?php
$str = 'Давайте устроим встречу 20.05.2022 и потом ещё одну 12.06.2022';
$str = preg_replace_callback("#(0[1-9]|[12][0-9]|3[01]).(0[1-9]|1[0-2]).(d{4})#m", function ($matches) {
return sprintf("%s [%s]", $matches[0], date('l', strtotime($matches[0])));
}, $str);
echo $str;