From 4253b0ca862aed465efa6d92b6aaa3bc08194216 Mon Sep 17 00:00:00 2001 From: akulikov Date: Tue, 20 Jan 2009 16:24:08 +0000 Subject: [PATCH] phone format git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@48 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Format.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/classes/Format.class.php b/classes/Format.class.php index c8c83cd..bfed71a 100644 --- a/classes/Format.class.php +++ b/classes/Format.class.php @@ -141,6 +141,16 @@ class Format } return ''; } + + static public function phone2int($phone) + { + $phone = str_replace(array(' ','-','(',')'), '', $phone); + $phone_length = strlen($phone); + if (is_numeric($phone) && ($phone_length == 7 || $phone_length == 10)) { //бывают семизначные прямые номера + return $phone; + } + return ''; + } } Format::setTimezoneOffset(date('Z'));