|
Posted by Janwillem Borleffs on 10/07/05 16:05
fender_gr wrote:
> I have tried the following but always matches the numbers accodring to
> the first if case :
>
> if (ereg("0030697", $myquery_called_number)) {
> $myquery_called_number='GENERAL'; } else { $myquery_called_number =
> "$myquery_called_
> number";}
>
For basic string matching, you should not use regexp, but simply:
if ($myquery_called_number == '0030697') {
...
}
If you still want you use regexp, you should indicate start and end
match of the pattern with '^' and '$':
if (ereg('^003069$', $myquery_called_number)) {
...
}
Or use preg_match, which generates less overhead then the ereg() function:
if (preg_match('/^003069$/', $myquery_called_number)) {
...
}
JW
Navigation:
[Reply to this message]
|