Results 1 to 4 of 4

Thread: 0 at the beginning

  1. #1
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Default 0 at the beginning

    I have a variable which has, let say the value of 1. I want to tack on a zero at the beginning so it has the value of 01. Thanks

  2. #2
    Join Date
    Jul 2008
    Posts
    199
    Thanks
    6
    Thanked 58 Times in 57 Posts

    Default

    PHP Code:
    $var '0' $var
    Note, that will make it a string. If it gets changed back to an integer, the zero will be removed.

  3. The Following User Says Thank You to techietim For This Useful Post:

    hosdank (08-23-2008)

  4. #3
    Join Date
    Jul 2008
    Posts
    65
    Thanks
    42
    Thanked 0 Times in 0 Posts

    Default

    Yeah, thanks anyway, but I got it by myself... That's the very basics, I don't know how I forgot

  5. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    More generally, str_pad().
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •