Re: Strip alternating spaces in first word of paragraph
| From: | Aaron Gould | Date: | Wed, 23 Feb 2005 16:56:28 +0000 |
| Subject: | Re: Strip alternating spaces in first word of paragraph | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-209253@lists.php.net to get a copy of this message | ||
Burhan Khalid wrote:
<?php $string = 'E n d l e s s insanity here!'; $letters = explode(" ",$string); foreach ($letters as $key => $letter) {Thanks for the example, looks like it might just work! -- Aaron Gould Programmer/Systems Administrator PARTS CANADAif (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"; ?>