Page 1 of 1

Where is the error?

Posted: Thu Jan 08, 2004 8:20 am
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

Posted: Thu Jan 08, 2004 8:21 am
by malcolmboston
you havent give us line 76 :lol:

Re: Where is the error?

Posted: Thu Jan 08, 2004 8:23 am
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.

Posted: Thu Jan 08, 2004 8:27 am
by fastfingertips
That was the line 76 :)
And indeed it needs that \.

Scorpus pleas enlighten me why that \ ?

Posted: Thu Jan 08, 2004 8:28 am
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?

Posted: Thu Jan 08, 2004 8:29 am
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: :?:

Posted: Thu Jan 08, 2004 8:36 am
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.

Posted: Thu Jan 08, 2004 8:47 am
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 :(