함수 email2local

함수 email2local

1 Bash[ | ]

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

2 PHP[ | ]

PHP
Copy
$email = 'helloworld@example.com';
$local = array_shift(explode('@', $email));
echo $local;
// helloworld
PHP
Copy
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 같이 보기[ | ]