함수 email2local

Jmnote (토론 | 기여)님의 2014년 8월 28일 (목) 10:09 판
함수 email2local

1 Bash

email=helloworld@example.com
local=`echo $email | cut -d@ -f1`
echo $local
# helloworld

2 PHP

$email = 'helloworld@example.com';
$local = array_shift(explode('@', $email));
echo $local;
// helloworld
function email2local($email) {
	$arr = explode('@', $email);
	if( count($arr) != 2 ) return false;
	return array_shift( $arr );
}
$email = 'helloworld@example.com';
echo email2local( $email );
// helloworld

3 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}