Hi guys,
Imagine i have this in my php code
$email = "[email protected]"
is it possible to echo out the first part of the email address turning it to
JamieWarren
so removing any fullstops and not echoing the last part of the email?
Thanks
Jamie
Printable View
Hi guys,
Imagine i have this in my php code
$email = "[email protected]"
is it possible to echo out the first part of the email address turning it to
JamieWarren
so removing any fullstops and not echoing the last part of the email?
Thanks
Jamie
You can use regular expressions or use explode()
:wave:
I would use explode() myself since I dont know regular expressions! This works assuming the email is formatted correctly.
PHP Code:$email = "[email protected]";
$explode = explode('@', $email);
$username = $explode[0];
$domain = $explode[1];
echo $username;
// prints dclamp
echo $domain;
// prints yahoo.com
Didnt notice you wanted to remove the period. Just use str_replace():
PHP Code:$email = str_replace(".", "", $email);