|
Posted by "Gustav Wiberg" on 09/20/05 16:04
----- Original Message -----
From: "Jochem Maas" <jochem@iamjochem.com>
To: "Gustav Wiberg" <gustav@varupiraten.se>
Cc: "PHP General" <php-general@lists.php.net>
Sent: Tuesday, September 20, 2005 2:24 PM
Subject: Re: [PHP] 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... :-)
Navigation:
[Reply to this message]
|