You are here: Re: [PHP] comment more than a question « PHP « IT news, forums, messages
Re: [PHP] comment more than a question

Posted by Leonard Burton on 10/21/91 11:31

HI Matt,

> i
> would get the "unexpected $ on line <two lines past the end of the script>
> error, I've figured out that actually means you are missing a closing } or
> a few
> also tonight, I was working on a script,

It will do this when you are missing a semi colon ";" at the end of a
line. The error is happening when PHP is reporting it for example:

print "going to the flea market?\n"
print "I am going to the flea market<br>\n";

The error is not happening until line two but the problem is that you
are missing a semicolon at the end of line one.

THe problem with misplaced braces "}" is that since they are normally
controlling the flow of the program the error could happen anywhere.

When I see an error that says something like "unexpected T_PRINT" I
look one or two lines above for a missing semicolon.

If a page of code has 90 lines and it says there is an error on 89 or
90 I start to count my {} pairs and see if I am missing one.

That is why I always do silly things like:
function test(){
do something;
do something else;
do more;
do even more;
hurry up;
move it;
get to work;
ok too much undo some work;
}//end function test()

This adds a few keystrokes but believe you me it sure saves a lot of
work when it comes to complex logic. You can then tell if you are
missing something. One of these days I am going to write a script to
analize my code for {} pairs and then it will tell me if one is
missing.

Once you get a good feel for where the error actually happens you will
be able to easily look back and find the problem.

Take care,

--
Leonard Burton, N9URK
leonardburton@gmail.com


"The prolonged evacuation would have dramatically affected the
survivability of the occupants."

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация