[PHP] Re: seems easy...
Hi Justin, $string = substr($string, 0, 5000) . text too long.; ? http://www.php.net/substr James Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Really simple, but can't see which funtion to use in the manual. I want to take a user-inputted string $text, and IF it's length is more than $limit, trim it to the limited length, and then tack on some kind of ... text cut (too long) thing on the end. I'm only missing one bit (line4): 1 $limit = 5000; 2 if(strlen($text) $limit) 3{ 4cut $text down to $limit length 5$text .= ...sorry, text was too long; 6} Or is it hard than that? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: seems easy...
Line 4 5 combined: $text = substr($text, 0, $limit) . ... your additional text here; Mike Frazer Justin French [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, Really simple, but can't see which funtion to use in the manual. I want to take a user-inputted string $text, and IF it's length is more than $limit, trim it to the limited length, and then tack on some kind of ... text cut (too long) thing on the end. I'm only missing one bit (line4): 1 $limit = 5000; 2 if(strlen($text) $limit) 3{ 4cut $text down to $limit length 5$text .= ...sorry, text was too long; 6} Or is it hard than that? Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]