Advertisement

05.25.2007 at 10:10AM PDT, ID: 22595257
[x]
Attachment Details

PHP trim string to remove words

Asked by chuckbeats in PHP Scripting Language

Tags: php, trim, string, remove, word

I need to trim a php string word by word until it is under a certain character limit.

ie I have a string "word1 word2 word3 word4 word5 word6"  
I have a string limit of 20 characters...which falls in the middle of a word - i need to trim the string to return:

"word1 word2 word3" -
I have thought of a few probably overcomplcated ways of doing this.
Any help is greatly appreciated.Start Free Trial
 
 
[+][-]05.25.2007 at 10:16AM PDT, ID: 19158504

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: php, trim, string, remove, word
Sign Up Now!
Solution Provided By: JamesCssl
Participating Experts: 5
Solution Grade: A
 
 
[+][-]05.25.2007 at 10:19AM PDT, ID: 19158528

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.25.2007 at 10:19AM PDT, ID: 19158529

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.25.2007 at 10:39AM PDT, ID: 19158690

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]05.26.2007 at 09:25AM PDT, ID: 19162188

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]06.11.2008 at 07:23AM PDT, ID: 21760314

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.15.2008 at 05:32AM PDT, ID: 21788375

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32