| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|parse error, unexpected T_VARIABLE in ...|
unexpected parse error
| 2:08 pm on Sep 1, 2002 (gmt 0)|
I am getting what seems to be a very unusual error which I belive may have something to do with my installation of php (its a new intallation). This is the simplified senerio.
I have a file which includes another file:
<? php include('file_2.php'); ?>
file 2 can contain a statement as simple as:
<?php $testVar = "this is a test";?>
and I get this error:
Parse error: parse error, unexpected T_VARIABLE in file_2.php on line 1
| 2:16 pm on Sep 1, 2002 (gmt 0)|
Welcome to WebmasterWorld rbailets
Post the whole code. this error is usually because you have a curly brace or something missing...
| 2:59 pm on Sep 1, 2002 (gmt 0)|
Thank you, for responding. It was a stupid error on my part. The error turned out to be a space between "<?" and "php"
| 3:40 pm on Sep 1, 2002 (gmt 0)|
I was going to say that .... lol
| 3:54 pm on Sep 1, 2002 (gmt 0)|
Yeah, I've been programming php for a long time and I still make errors like that. You just need to really scrutinize your syntax before thinking somethings wrong ;) I do it all the time!
| 11:52 pm on Sep 2, 2002 (gmt 0)|
Having an editor with syntax highlighting helps a great deal to avoid errors like that. Whenever the color doesn´t change the way you expect it to, there is some (stupid) mistake.
The automatic indenting feature of many editors helps, too. I use it to spot errors in php, perl, css, html code.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2013 all rights reserved