Pregunta

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
¿Fue útil?

Solución

Use strstr()

echo strstr( $_POST['email'],'@',true);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top