<?php
error_reporting(-1);

$phoneNumber = "+7 (911) - 123 - 45 - 67";
$regexpForMatching = "/^ *(\+ *7|8)([ ()-]*\d){10}$/";
$regexpForPrefixSubstitution = "/\+ *7/";
$regexpForSubstitution = "/[ ()-]/";

if (preg_match($regexpForMatching, $phoneNumber)){
	$result = preg_replace($regexpForPrefixSubstitution, "8", $phoneNumber);
	$result = preg_replace($regexpForSubstitution, "", $result);
	echo $result;
}