Re: Replacing first character in a string
| From: | Pierrick LE GALL | Date: | Thu, 01 May 2003 07:12:32 +0000 |
| Subject: | Re: Replacing first character in a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-145908@lists.php.net to get a copy of this message | ||
"Lee P. Reilly" <lreilly@lanl.gov> writes:
> Hi there,
Hi
> If the *first character* in the string is a comma then I want to
> replace it with "0,", but I cannot find a way to do it.
try this :
preg_replace( '/^,/', '0', $string );
--
Pierrick LE GALL | http://www.phpwebgallery.net