1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Rep Power
    How to get username before @ in email address. It means:

    $email = "xiaoguiwxd@...";
    then, I can get username as
    $user_name = "xiaoguiwxd";

    How can I do it?
    I use the following snippet, but it does't work.

    ---------------------------------------snippet start
    $user_name = $user_name[0];
    ---------------------------------------snippet end

    Good Good Study
    Day Day Up
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Caro, Michigan
    Rep Power
    Not sure of a regex way to do it, but this should work:

    $email = "john@sepodaticreations.com";
    $parts = explode("@",$email);
    $username = $parts[0];


Similar Threads

  1. inserting multiple email address from a textarea
    By mrkgrav in forum PHP Development
    Replies: 17
    Last Post: September 24th, 2004, 06:28 PM
  2. Regular Expression for multiple email address
    By L John in forum HTML Programming
    Replies: 2
    Last Post: January 29th, 2004, 06:41 AM
  3. Sendmail - Advanced Routing based on email address
    By gd_aligner in forum Mail Server Help
    Replies: 0
    Last Post: January 22nd, 2004, 10:14 AM
  4. Lookup exchange user from email address in outlook vba
    By branston in forum Visual Basic Programming
    Replies: 1
    Last Post: January 11th, 2004, 04:45 AM
  5. HTML: submitting forms to hidden email address?
    By kitiwiti in forum Beginner Programming
    Replies: 4
    Last Post: December 21st, 2003, 09:17 PM

IMN logo majestic logo threadwatch logo seochat tools logo