There is a small function that processes the phone number before the output, the problem is that the function incorrectly displays the phone, for example, the number is recorded 9061755555, then it displays in the format (906) 175-55-55. Ukrainian, Russian ... How to add a function so that it substitutes +3 if it is not there or +7 generally formatted the phone beautifully ...
function echoNumber($aphone) // номер в формате (xxx) xxx-xx-xx { $sArea = substr($aphone, 0, 3); $sNumber1 = substr($aphone, 3, 3); $sNumber2 = substr($aphone, 6, 2); $sNumber3 = substr($aphone, 8, 2); $aphone = "(" . $sArea . ") " . $sNumber1 . "-" . $sNumber2 . "-" . $sNumber3; return ($aphone); }