|
Posted by Toby A Inkster on 03/06/07 11:10
Mike Russell wrote:
> Big suggestion: consider using a debug environment - life will be much more
> pleasant. It will take several days to set up, but I think you will find it
> is well worth it.
I considered this, but then decided the best way to avoid those long hours
of bug hunting was to just write code that doesn't have any bugs in it. I
don't know why I never thought of that before -- all those years of
writing code with bugs in it and then debugging it -- much easier just not
to write the bugs in the first place. ;-)
More seriously, no matter how good you get at PHP, these silly little
syntax errors like misplaced brackets and missing semicolons are always
the ones that come back to bite you.
If you (not you in particular, Mike; I am referring to the general "you")
don't already have the command line version of PHP, then get it, and run
"php -l filename" on any file before you try using it. It will catch any
parsing errors in the file.
After that, enabling PHP's normal error reporting should provide fairly
helpful error messages, such as when you don't provide enough parameters
for a particular function, or if you've not implemented a particular
interface correctly, and so forth. When relevant, it tells you the exact
file and line number where the problem is. These bugs are usually fairly
simple to fix.
Then you "only" have to deal with logic errors. :-)
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
* = I'm getting there!
[Back to original message]
|