Welcome to WebmasterWorld Guest from 54.144.79.200

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

parse error, unexpected T_VARIABLE in ...

unexpected parse error

     

rbailets

2:08 pm on Sep 1, 2002 (gmt 0)

10+ Year Member



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

Nick_W

2:16 pm on Sep 1, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Welcome to WebmasterWorld rbailets

Post the whole code. this error is usually because you have a curly brace or something missing...

Nick

rbailets

2:59 pm on Sep 1, 2002 (gmt 0)

10+ Year Member



Nick,

Thank you, for responding. It was a stupid error on my part. The error turned out to be a space between "<?" and "php"

Ralph

dhdweb

3:40 pm on Sep 1, 2002 (gmt 0)

10+ Year Member



I was going to say that .... lol

Nick_W

3:54 pm on Sep 1, 2002 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member



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!

Nick

andreasfriedrich

11:52 pm on Sep 2, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



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.