Welcome to WebmasterWorld Guest from 54.242.224.250

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)

Inactive Member
Account Expired

 
 


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 Sept 1, 2002 (gmt 0)

Senior Member

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

joined:Feb 4, 2002
posts:5044
votes: 0


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 Sept 1, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


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

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

Full Member

10+ Year Member

joined:Apr 4, 2002
posts:236
votes: 0


I was going to say that .... lol
3:54 pm on Sept 1, 2002 (gmt 0)

Senior Member

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

joined:Feb 4, 2002
posts:5044
votes: 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!

Nick

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 22, 2002
posts:1782
votes: 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.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members