register_form_update.php, orderformupdate.php 파일에서 사용할 수 있습니다.
사용법은 아래와 같습니다.
$mb_tel = hyphen_tel_number($mb_tel);
$od_tel = hyphen_tel_number($od_tel);
$od_b_tel = hyphen_tel_number($od_b_tel);
common.lib.php 파일에 넣어주세요.
// 전화번호의 숫자만 취한 후 중간에 하이픈(-)을 넣는다.
// 전화번호의 숫자만 취한 후 중간에 하이픈(-)을 넣는다.
function hyphen_tel_number($tel)
{
$tel = preg_replace("/[^0-9]/", "", $tel);
if (substr($tel,0,2)=='02')
return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18'))
return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel);
else
return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
}
사용법은 아래와 같습니다.
$mb_tel = hyphen_tel_number($mb_tel);
$od_tel = hyphen_tel_number($od_tel);
$od_b_tel = hyphen_tel_number($od_b_tel);
common.lib.php 파일에 넣어주세요.
// 전화번호의 숫자만 취한 후 중간에 하이픈(-)을 넣는다.
// 전화번호의 숫자만 취한 후 중간에 하이픈(-)을 넣는다.
function hyphen_tel_number($tel)
{
$tel = preg_replace("/[^0-9]/", "", $tel);
if (substr($tel,0,2)=='02')
return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18'))
return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel);
else
return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
}
댓글 4개
게시글 목록
| 번호 | 제목 |
|---|---|
| 24318 | |
| 24317 | |
| 24315 | |
| 24309 | |
| 24294 | |
| 24293 | |
| 24277 | |
| 24262 | |
| 24260 | |
| 24253 | |
| 24251 | |
| 24236 | |
| 24233 | |
| 24228 | |
| 24226 | |
| 24221 | |
| 24214 | |
| 24203 | |
| 24201 | |
| 24199 | |
| 24196 | |
| 24195 | |
| 24194 | |
| 24192 | |
| 24191 | |
| 24187 | |
| 24185 | |
| 24183 | |
| 24172 | |
| 24168 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기