Use strstr()
echo strstr( $_POST['email'],'@',true);
Question
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
Solution
Use strstr()
echo strstr( $_POST['email'],'@',true);