Re: Easy question - delete strings from the beginning of space...
| From: | Jochem Maas | Date: | Tue, 20 Sep 2005 12:24:49 +0000 |
| Subject: | Re: Easy question - delete strings from the beginning of space... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222753@lists.php.net to get a copy of this message | ||
Gustav Wiberg wrote:
Hi there! I guess this is an easy question. I have string... "Hello you" and I want to get the "Hello" part. How do I do that? (I can of course search for first occurence of space and then use substr, but I guess there is an easier solution?how much easier do you want it? oh and guessing kinda sucks. $str = "Hello World"; $words = explode(" ", $str); echo $words[0]; ... but what if you have double spaces, or a space at the beginning?
/G http://www.varupiraten.se/