Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 8th, 2003, 03:11 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.
__________________
~~~~~~~~~~~~~~~~~~~~~~~
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://ebcpro.com.com
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where EveryBusinessCounts
~~~~~~~~~~~~~~~~~~~~~~~
 
Old June 9th, 2003, 03:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

how about putting a ; after $date = "1/03/2003"
 
Old June 9th, 2003, 01:30 PM
sam sam is offline
Authorized User
 
Join Date: Jun 2003
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks:),
Boy do I feel stupid sorry for bothering you.
Sam
 
Old June 10th, 2003, 03:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hey, don't worry about it. No bother.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex pendemv JSP Basics 4 December 8th, 2008 08:29 AM
Regex.IsMatch - receive a parsing error smcirish VB How-To 1 June 14th, 2007 12:21 AM
Regex htran XSLT 2 May 18th, 2005 09:21 AM
More regex help Snib Pro PHP 4 December 16th, 2004 09:56 PM
RegEx Server.Create Object Error ckwizard77 Classic ASP Professional 1 September 2nd, 2004 03:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.