$str1 = 'Lorem {val1} dolor sit {val2}, consectetur adipisicing {val3}';
$str2 = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit';
$words1 = explode(' ', $str1);
$words2 = explode(' ', $str2);
$items = count($words1);
$result = [];
for($i = 0; $i< $items; $i++) {
if(preg_match('/{\w*}/', $words1[$i])) {
$result["$words1[$i]"] = $words2[$i];
}
}
print_r($result);
$regex = "([а-яА-Яa-zA-Z0-9]*|[.,-_!?;:'\(\)\"]*)";
$string = "МАЗ 5551 - популярный белорусский грузовик-самосвал, с самосвальным оборудованием. Он выпускается на минском автомобильном заводе!";
preg_match_all("/$regex/", $string, $matches);
$matches = $matches[1];
array_walk($matches, function ($value, $key) use (&$matches) {
if(strlen($matches[$key]) < 1) {
unset($matches[$key]);
}
});
echo '<pre>';
print_r($matches);
$str1 = '(56.61926920000001, 84.88168339999993):8';
$str2 = '56.61926920000001, 84.12';
$str3 = '56.61926920000001, 84';
preg_match_all('/([\d]*[.][\d]*)/', $str1, $matches);
print_r($matches[1]);
// [0] => 56.61926920000001
// [1] => 84.88168339999993
preg_match_all('/([\d]*[.][\d]*)/', $str2, $matches);
print_r($matches[1]);
// [0] => 56.61926920000001
// [1] => 84.12
preg_match_all('/([\d]*[.][\d]*)/', $str3, $matches);
print_r($matches[1]);
// [0] => 56.61926920000001