<?php
$input = "8-495-1-234-567";
$regexp = '/^\\+?8?7?\';
$matches = array();
if(preg_match($regexp, $input, $matches)){
echo "Все верно.\n";
var_dump($matches);
}else{
echo "Ошибка";
}
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKCiRpbnB1dCA9ICI4LTQ5NS0xLTIzNC01NjciOwokcmVnZXhwID0gJy9eXFwrPzg/Nz9cJzsKJG1hdGNoZXMgPSBhcnJheSgpOwoKaWYocHJlZ19tYXRjaCgkcmVnZXhwLCAkaW5wdXQsICRtYXRjaGVzKSl7CgllY2hvICLQktGB0LUg0LLQtdGA0L3Qvi5cbiI7Cgl2YXJfZHVtcCgkbWF0Y2hlcyk7Cn1lbHNlewoJZWNobyAi0J7RiNC40LHQutCwIjsKfQ==