Reply to Re: [PHP] Easy question - delete strings from the beginning of space...

Your name:

Reply:


Posted by Jordan Miller on 09/20/05 18:19

to get rid of potential double spaces after the explode, you could do:
foreach ($words as $word) {
if (!empty($word)) {
$first = $word;
break;
}
}
echo $first;

This will always return the first word.

Jordan



On Sep 20, 2005, at 7:24 AM, Jochem Maas wrote:

> 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?
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация