SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    split deprecated problem

    Hello

    I have this

    $email="test@domain.com";
    list($user_email, $domain_email) = split("@", $email);

    It was returning $user_email and $domain_email from $email.
    Now with 5.3.x split is deprecated , how to convert the code above ?

    Thank you
    trcris ::> http://www.trcris.com

  2. #2
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by graziano68 View Post
    Hello

    I have this

    $email="test@domain.com";
    list($user_email, $domain_email) = split("@", $email);

    It was returning $user_email and $domain_email from $email.
    Now with 5.3.x split is deprecated , how to convert the code above ?

    Thank you

    I think I have found the solution myself

    $email="test@domain.com";
    list($user_email, $domain_email) = preg_split("/@/", $email);

    It seems to work , is it correct ?
    trcris ::> http://www.trcris.com

  3. #3
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Not really, if you aren't using regular expressions then split() and preg_match() aren't what you're looking for.

    What you want is explode().
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  4. #4
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's working
    trcris ::> http://www.trcris.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •