Try (this is untested)

if (length($string) > 30) {
  print substr($string, 0, 30) ."...";
}
else {
  print $string;
}

--OR-- (if you want to over-write $string)

$string = ((length($string) >= 30) ? substring($string, 0, 30) ."..." :
$string );

--
Scott Hurring
Systems Programmer
EAC Corporation
scott (*) eac.com
--
"Hawk" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Lets say I have a news text, and in a menu, I just want to print the first..
> lets say 30 letters, and maybe add a "..." after, and link it to the full
> text.
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to