Re: First stupid post of the year.
| From: | Robert Cummings | Date: | Wed, 02 Jan 2008 20:20:46 +0000 |
| Subject: | Re: First stupid post of the year. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266521@lists.php.net to get a copy of this message | ||
<?php
$foo = ' A
';
$foo = str_replace( ' ', ' ', $foo );
$foo = trim( ereg_replace( '[ ]+', ' ', $foo ) );
echo '['.$foo.']'."\n";
?>
I could have replaced ' ' with the empty string, but in case you
have labels with more than one word I took a normalizing approach.
Cheers,
Rob.
On Wed, 2008-01-02 at 13:34 -0500, tedd wrote:
> Hi gang:
>
> I have a
>
> $submit = $_POST['submit'];
>
> The string contains:
>
> A
>
> (it's there to make a submit button wider)
>
> How can I strip out the " " from the $submit string leaving "A"?
>
> I've tried
>
> trim($submit);
>
> but, that don't work.
>
> Neither does:
>
> $submit = str_replace(' ','',$submit);
>
> or this:
>
> $submit = str_replace(' ';','',$submit);
>
> I should know what to do, but in this case I don't.
>
> Help is always appreciated.
>
> Cheers,
>
> tedd
>
> --
> -------
> http://sperling.com
> http://ancientstones.com
> http://earthstones.com
>
--
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................