Re: replace digits

From: Date: Tue, 19 Mar 2002 09:19:51 +0000
Subject: Re: replace digits
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-89081@lists.php.net to get a copy of this message
Hi Marc, try this: $string = preg_replace("/^41/", "0", $string); http://www.php.net/preg_replace / and / = delimiters ^ = start of string (line in multiline mode) So, it translates as, "replace a leading 41 in $string with 0". ..or try the ereg function, which has already been mentioned. James "Marc Bleuler" <marc@bleuler.net> wrote in message news:20020318222506.36668.qmail@pb1.pair.com... > Hello all, > > Im trying to replace the first two digits (41) from a telephone no. with a 0 > (zero), like 41763334455 should end wit 0763334455. Anybody a idea howto? My > php programming experiance is not very high so if any body could provide a > code example.... > > thank you very mutch for help > Marc > >

« previous php.general (#89081) next »