#10: Error Reporting

When you're writing code, it's very easy to forget about a variable name or to write deprecated code. At times, PHP is so user friendly (by programming standards) that it will actually work around many subtle coding mistakes.

For example, PHP allows you to write a program without declaring all of your variables at the start, which is convenient right up until you misspell $string as $stirng, and your program chokes on a null value. You can also pass variables to functions in totally incorrect ways that work most of the time because PHP makes some assumptions about what you meant. That's great until PHP guesses incorrectly, and then you'll be scratching your head over a mysterious bug.

To stop PHP from quietly fixing problems, ...

Get Wicked Cool PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.