SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast weekyd's Avatar
    Join Date
    Jun 2004
    Location
    UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    string replace help..

    hi..nubs here
    i have some data from 1 to 99
    from 1 to 9 they start with 00 and from 10 onwards they star with 0
    so 001--009 and 010...099

    can someone help me to get rid of them 0 and 00 so i end up with whole integer...its to do with pregmatch or str_replace.. i'm stuck

    thanks

  2. #2
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may want to use intval to get an integer value.

    PHP Code:

    echo intval('099'); // 99 
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine

  3. #3
    SitePoint Enthusiast weekyd's Avatar
    Join Date
    Jun 2004
    Location
    UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cheers dude..i knew it was something siimple


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
  •