error in regex.
I ran the following code which I got from page 205 of Pro. PHP4:
<?php
$date = "1/03/2003"
if(ereg("([0-9]{1,2})-([0-9]{1,2})-([0-9]{4})",$date,$regs))
{
echo("$regs[2].$regs[1].$regs[3]");
}
else
{
echo("invalid: $date");
}
?>
I go the error:
Parse error: parse error, unexpected T_IF in c:\inetpub\wwwroot\PHP\Pro_PHP\Ch07\regex.php on line 4
Please help me find what I missed.
Thanks,
Sam.
P.S. I'm on a win2000 machine.
__________________
~~~~~~~~~~~~~~~~~~~~~~~
http://ebcpro.com.com
where EveryBusinessCounts
~~~~~~~~~~~~~~~~~~~~~~~
|