As you saw in the last chapter, there are quite a few ways to help you track down problems in your code. Having said that, the very first thing you should do upon seeing an error message in one of your scripts is to visually examine the relevant source code - even if only for a few moments. Not only does this refresh your memory about what is going on in that particular area, but very often you will find the problem is something trivial that you can spot and fix in seconds.
In order to make this point clear, and also to hopefully train up your brain in spotting fairly straightforward bugs, cast your eyes over these three simple scripts and find the obvious bugs:
print "Hello world!
print "Hello world!":
print "Hello world!';
Want to learn PHP 7?
Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!