Re: cut text?

From: Date: Tue, 11 Jun 2002 20:31:33 +0000
Subject: Re: cut text?
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-101613@lists.php.net to get a copy of this message
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" <hw2k@barrysworld.com> wrote in message news:20020611193729.95973.qmail@pb1.pair.com... > 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. > > >

« previous php.general (#101613) next »