SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    I'm in your computer! Halo-13's Avatar
    Join Date
    Jun 2004
    Location
    Minneapolis, MN
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I call digits out of a sting variable

    I have a variable - Erickson1008

    How do I get just the digits out of that variable and in to a new variable?

    Any help would be great thanks!
    Halo-13 Network
    ArcadeApe

  2. #2
    SitePoint Addict CommanderZ's Avatar
    Join Date
    Apr 2006
    Location
    Czech Republic
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use regexp to replace all non-numeric characters with "".

  3. #3
    Keep it simple, stupid! bokehman's Avatar
    Join Date
    Jul 2005
    Posts
    1,935
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $out preg_replace('/[^\d]/'''$in), 


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
  •