Re: comment more than a question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx


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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux