Jump to content

pulling first word


ball420

Recommended Posts

uhh.. isnt

<?PHP
$r = explode("@",$email);
echo $r[0];
?>

 

easier to understand if he doesn't get your termonology?

 

Explode() arrays before and after every @ in a string of text, so $r[1] would be hotmail.com or something similar.

 

Good luck

Link to comment
Share on other sites

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 =  "bob_the-Builder@our-house.com";

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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.