<?php
error_reporting(-1);

$arr = array('84951234567', '+74951234567', '8-495-1-234-567', ' 8 (8122) 56-56-56', '8-911-1234567', '8 (911) 12 345 67', '8-911 12 345 67', '8 (911) - 123 - 45 - 67', '+ 7 999 123 4567', '8 ( 999 ) 1234567', '8 999 123 4567');
$check = '#^[()\\-\\s]*(([+][()\\-\\s]*7)|8)([()\\-\\s]*[0-9]){10}$#';
$replace = '#\\+7#';
$clean = '#\\W#';
foreach ($arr as $input){
if(preg_match($check, $input)){
	echo "Верно\n";
}else{
	echo"Ошибка\n";
}

$output = preg_replace($clean, "", $input);
$outputFinal = preg_replace($replace, "8", $output);
echo $outputFinal."\n";}
