php-windows | 2001042
Date: 04/18/01
- Next message: joel <email protected>: "Re: [PHP-WIN] mssql and php4"
- Previous message: Andrian Pervazov: "[PHP-WIN] MSSQL varchar fields truncation revisited"
- In reply to: Asendorf, John: "RE: [PHP-WIN] eregi in an IF statement...."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You have additional ")" and this makes you regex invalid.
> > if ( eregi ( "([0-9]{3,3})([0-9]{3,3})([0-9]{4,4}))" , $phone
> > elseif ( eregi ( "([0-9]{3,3})([0-9]{4,4}))" , $phone , $edit ) ) {
I guess you are not displaying all errors. Try error_reporting = E_ALL (PHP4) or
15 (PHP3).
You should see warnings.
Regards,
-- Yasuo Ohgaki""Asendorf, John"" <JAsendorf <email protected>> wrote in message news:620001CE6A56D41189F300B0D0220374459EAB <email protected> > I stared at that for an hour and never saw it... > > Thanks Brad. > > --------------------- > John Asendorf - jasendorf <email protected> > Web Applications Developer > http://www.lcounty.com - NEW FEATURES ADDED DAILY! > Licking County, Ohio, USA > 740-349-3631 > Aliquando et insanire iucundum est > > > > -----Original Message----- > > From: Brad S. Jackson [mailto:bjackson <email protected>] > > Sent: Tuesday, April 17, 2001 5:42 PM > > To: Asendorf, John > > Subject: Re: [PHP-WIN] eregi in an IF statement.... > > > > > > > > > > Why do you have two )) at the end of the eregi calls? > > > > > > "Asendorf, John" <JAsendorf <email protected>> wrote: > > I'm attempting to fix a little flaw that I have. > > > > I have a legacy database which has a mix of 10 and 7 digit > > phone numbers in > > it. > > > > I first designed the function format_phone with this (under > > the assumption > > of 10 digit phone numbers): > > > > function format_phone ( $phone ) { > > > > $phone = eregi_replace ( > > "([0-9]{3,3})([0-9]{3,3})([0-9]{4,4})", "(\\1) > > \\2-\\3" , $phone ); > > return $phone; > > } > > > > > > It worked just fine... > > > > But when I switched to the code below, it doesn't work with any of the > > numbers, they all come back as not recognized. > > > > > > if ( eregi ( "([0-9]{3,3})([0-9]{3,3})([0-9]{4,4}))" , $phone > > , $edit ) ) { > > //10 digits > > $phone = "(" . $edit[1] . ") " . $edit[2] . "-" . $edit[3]; > > } > > > > elseif ( eregi ( "([0-9]{3,3})([0-9]{4,4}))" , $phone , $edit ) ) { > > //7 digits > > $phone = $edit[1] . "-" . $edit[2]; > > } > > > > else { echo "phone not recognized"; } > > > > > > Any suggestions? > > > > John > > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-windows-unsubscribe <email protected> > For additional commands, e-mail: php-windows-help <email protected> > To contact the list administrators, e-mail: php-list-admin <email protected> >
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe <email protected> For additional commands, e-mail: php-windows-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: joel <email protected>: "Re: [PHP-WIN] mssql and php4"
- Previous message: Andrian Pervazov: "[PHP-WIN] MSSQL varchar fields truncation revisited"
- In reply to: Asendorf, John: "RE: [PHP-WIN] eregi in an IF statement...."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

