Вопрос

i have a login form, where the user must type in his e-mail address. Now i want to cut off the @ and the e-mail domain and save this as username.

For example:

$email = $_POST['email'];
//$email = muster.hans@gmail.com

now the username should be:

muser.hans
Это было полезно?

Решение

Use strstr()

echo strstr( $_POST['email'],'@',true);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top