Frage

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
War es hilfreich?

Lösung

Use strstr()

echo strstr( $_POST['email'],'@',true);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top