Jump to content

pulling first word


ball420

Recommended Posts

OK this was just some pratice for me but i thought i'll post it :)

 

this check the email is valid and get the alias and host

 

as a note Anzeo is better (being simpler and quicker)

this does check for a valid domain name

(thats name, it doesn't mean it a valid email as the domain may not exist)

 

<?php
$email =  "[email protected]";

if (eregi('([A-Z0-9._%-]+)@([A-Z0-9.-]+\.[A-Z]{2,4})', $email, $regs))
{
$EmailAlias = $regs[1];
$EmailHost= $regs[2];
}

echo $EmailAlias;
echo "<br />@<br />";
echo $EmailHost;
?>

Link to comment
https://forums.phpfreaks.com/topic/48668-pulling-first-word/#findComment-238516
Share on other sites

I don't exactly see why he would want to "revalidate" the email if its already stored somewhere (assuming he validates it when they register >_>), and i never really heard of an email being valid with two @ symbols so the extra work is kinda unnecessary for something so simple.

 

And thanks for the heads up on the list() function, i didnt know it existed until you said somethin :-P, though I still dont see the need of doing that if he only wants the first part from the email.

Link to comment
https://forums.phpfreaks.com/topic/48668-pulling-first-word/#findComment-238544
Share on other sites

And thanks for the heads up on the list() function, i didnt know it existed until you said somethin :-P, though I still dont see the need of doing that if he only wants the first part from the email.

 

It's the easiest way to do so :). You even could let out $Host, it would only store the alias then.

Link to comment
https://forums.phpfreaks.com/topic/48668-pulling-first-word/#findComment-238570
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.