----- Original Message -----
From: "Gustav Wiberg" <gustav@xxxxxxxxxxxxxx>
To: "Jochem Maas" <jochem@xxxxxxxxxxxxx>
Cc: "PHP General" <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, September 20, 2005 3:04 PM
Subject: Re: Easy question - delete strings from the beginning of
space...
----- Original Message -----
From: "Jochem Maas" <jochem@xxxxxxxxxxxxx>
To: "Gustav Wiberg" <gustav@xxxxxxxxxxxxxx>
Cc: "PHP General" <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, September 20, 2005 2:24 PM
Subject: Re: Easy question - delete strings from the beginning of
space...
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/
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.3/106 - Release Date:
2005-09-19
Hi there!
Ok, I'll think I do it in my way because of double spaces etc...
Thanx anyway!
/G
http://www.varupiraten.se/
ps. Forgive me for guessing... :-)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php