Re: ereg function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ereg function doesn't have the capability to test the age of the
person viewing your page. You have to depend on them to input their
age in some way.

Your answer depends on how your age is submitted. Assuming it is
submited as $_POST['age'], you could perhaps use ereg("0*[7-9]$",
$_POST['age']) - that might work but I haven't used ereg - ever, I
perfer to use the faster PCRE regex functions, such as
preg_match("/^0*[7-9]$/", $_POST['age']); which will match any amount
of zeros, followed by anything between 7 and 9, ie 8,
0000000000000000008, or 08

Having all that said, I wouldn't use reges for smething like this.

On Fri, 31 Dec 2004 15:46:46 -0500 (EST), Michael Lutaaya
<mlutaaya@xxxxxxxxxx> wrote:
> I want to validate someones age. How do I do this in
> the ereg function.
> 
> I also have some visitors on my site who are in
> between the ages of 7-9 so don't forget to make them
> part of the ereg function.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux