RE: [PHP] selecting words

From: Date: Wed, 08 Aug 2001 08:18:49 +0000
Subject: RE: [PHP] selecting words
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61767@lists.php.net to get a copy of this message
>There was a post earlier very similar to this. If you have a database, you >could use SELECT LEFT(mycolumn, 100) FROM mytable WHERE ... >Without a db, you can use the PHP substring function: >substr() Except that would return the first 100 characters and not the first 100 words as requested. To do this you would need to find the 100th space in the string and use everything before that. I would probably explode the string and loop through the first one hundred elements to reconstruct the string with the first one hundred words. Regards Jon Jon Farmer Systems Programmer Entanet International Ltd www.enta.net Tel 01952 428969 Mob 07968 524175

« previous php.general (#61767) next »