You are here: Re: [PHP] Strip alternating spaces in first word of paragraph « PHP « IT news, forums, messages
Re: [PHP] Strip alternating spaces in first word of paragraph

Posted by Aaron Gould on 02/23/05 18:56

Burhan Khalid wrote:
> <?php
>
> $string = 'E n d l e s s insanity here!';
>
> $letters = explode(" ",$string);
> foreach ($letters as $key => $letter)
> {
> if (strlen($letter) == 1)
> {
> //Possible letter of our first word
> $word .= $letters[$key];
> } else {
> $split_point = $key;
> }
> }
> echo "Original : ".$string."\n";
> echo "Word : ".$word."\n";
> echo "Modified : ".$word." ";
> echo implode(" ",array_slice($letters,$split_point-1))."\n";
> ?>

Thanks for the example, looks like it might just work!
--
Aaron Gould
Programmer/Systems Administrator
PARTS CANADA

 

Navigation:

[Reply to this 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

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