...

View Full Version : Shortening an array item



snowball
07-10-2002, 02:40 PM
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 :rolleyes:

chrisvmarle
07-10-2002, 03:46 PM
$field1[7] = substr($field1[7],0,40);

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

Mzzl, Chris

snowball
07-10-2002, 04:51 PM
Thanks .......

It works great. I appreciate it.

snow



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum