On Wed, 27 Aug 2003 21:30:25 -0700, you wrote: >Want to remove the string after the first whitespace like: > >"here is a text what i have" >to: >"here"
I'd explode() the string into an array, and take the 0th element of the array. $s = 'here is a text what i have'; $a = explode (' ', $s); echo ($a[0]); If you want to match /whitespace/ (tab, space, etc), replace explode() with split() using the correct regular expression. (Note: explode() takes a 3rd optional parameter, limit, if you want a remainder string, too.) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php