?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


?
?ereg confuse
Author:??(---.wlink.com.np)
Date:???08-17-04 21:26

can anybody make me understand it?
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
echo "$regs[3].$regs[2].$regs[1]";
} else {
echo "Invalid date format: $date";
}
?>

?Re: ereg confuse
Author:??(80.242.8.---)
Date:???08-18-04 10:59

This is for testing the string $regs. The first part check it if it is according to a year format (4 digits, from 0 to 9 for each digit). The second and third part for checking either day or month (1 or 2 digits, again from 0 to 9, although you need only 1 to 12 for months and 1 to 31 for days).
Is it clear? This is based on "regular Expressions".
Good luck!

Go to Top??|??Go to Topic??|??Threaded View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??

Provided By
Phorum