Web Analytics Made Easy -
StatCounter Shortening an array item - CodingForum

Announcement

Collapse
No announcement yet.

Shortening an array item

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Shortening an array item

    Hi

    Can anyone help. In a CGI script I have a array item which can be any length.

    It's called $field1[7]

    What do I have to do to make $field1[7] just its first 40 characters ..... (if less than 40, that's fine)

    If anyone could help with a line or two of code, I'd really appreciate it....

    Thanks

    snow

  • #2
    $field1[7] = substr($field1[7],0,40);

    That takes the first 40 characters of $field1[7] (if they exist)

    Mzzl, Chris
    My Website
    010100010011110101110100011011110111000001101000

    Comment


    • #3
      Thanks .......

      It works great. I appreciate it.

      snow

      Comment

      Working...
      X