Try
ereg(^[0-9]{10}$, $cust_tel);
Quick explanation (I get the feeling you're new at regexes):
^ - beginning of string
[0-9] - any number between 0 and 9 inclusive
{10} - exactly ten times
$ - end of string
There ya go.
J
B. Verbeek wrote:
Hello,
I want to check the data from a
Hi Bart,
I want to check the data from a form-field if it excists only of digits
(0-9) and nothing else.
How do I use the ereg()-function for this?
Well, I prefer the preg_functions
if (!preg_match(/^[0-9]{10}$/, $string)) {
// contains stuff other than numbers, or is less than 10 digits
On Wed, 2002-01-30 at 08:16, liljim wrote:
Hi Bart,
I want to check the data from a form-field if it excists only of digits
(0-9) and nothing else.
How do I use the ereg()-function for this?
Well, I prefer the preg_functions
if (!preg_match(/^[0-9]{10}$/, $string)) {
// contains
3 matches
Mail list logo