SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member OhSqueezy's Avatar
    Join Date
    Jul 2001
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Determining String Length

    I need a function that will return the number of characters in a string. All I could seem to find was count_chars() which only works in PHP4 (I'm forced to use PHP3).

    What I want to do is truncate a string using substr() based on the length of the string. I have a column for image sizes in bytes, and I want to be able to return the size in kilobytes, therefore I figure I have to return the first two numbers of a string of five numbers, but only the first number in a string of 4.

  2. #2
    SitePoint Wizard
    Join Date
    Jul 1999
    Location
    Chicago
    Posts
    2,629
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  3. #3
    SitePoint Member OhSqueezy's Avatar
    Join Date
    Jul 2001
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sweet, that's exactly what I was looking for, I can't believe I couldn't find it. Thanks a bunch .


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
  •