Where is the error?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Where is the error?

Post by fastfingertips »

Code: Select all

<?php
var $emailpattern =  "^[a-z0-9]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*.[a-z]{2,3}$"; 

?>
Error message:
Parse error: parse error, unexpected '\"' in engine.php on line 76
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

you havent give us line 76 :lol:
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Re: Where is the error?

Post by scorphus »

Try this:

Code: Select all

<?php
var $emailpattern =  "^[a-z0-9]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*.[a-z]{2,3}\$"; //...$" => ...\$"
?>
Cheers,
Scorphus.
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

That was the line 76 :)
And indeed it needs that \.

Scorpus pleas enlighten me why that \ ?
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

there isnt a \ in his code, so how is it finding that is the error?

you sure youve given us the correct line?
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

Yes because once i have modified my line according to scorpus recs now is working fine.

Scorpus please enlighten me why that \ ? :oops: :?:
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Sure! I was editing this post ;)

\ is the escape operator. See the Strings section of the PHP Manual and also string parsing for accurate further information and examples.

Cheers,
Scorphus.
fastfingertips
Forum Contributor
Posts: 242
Joined: Sun Dec 28, 2003 1:40 am
Contact:

Post by fastfingertips »

Thank you

The pages were already printed (from manual) and now i'm studying them :)
I have passed some things and now i see the results :(
Post Reply