Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NETTUTS.com:
Are You Making These 10 PHP Mistakes?
Feb 04, 2009 @ 15:33:51

All of you developers out there, NETTUTS.com has a question for you - are you making any of these ten PHP mistakes in your day to day development? Which ones, you ask? Read on...

Here are 10 PHP mistakes that any programmer, regardless of skill level, might make at any given time. Some of the mistakes are very basic, but trip up even the best PHP programmer. Other mistakes are hard to spot (even with strict error reporting). But all of these mistakes have one thing in common: They're easy to avoid.

Here's the list (as Glen Stanberry sees it):

  • Single quotes, double quotes
  • Semicolon after a While
  • NOT Using database caching
  • Missing Semicolon After a Break or a Continue
  • Not Using E_ALL Reporting
  • Not Setting Time Limits On PHP Scripts
  • Not Protecting Session ID's
  • Not Validating Cookie Data
  • Not Escaping Entities
  • Using Wrong Comparison Operators
tagged: mistakes list common quotes semicolon error session cookie escape

Link:

Jani Hartikainen's Blog:
Three PHP mistakes that will cause you debugging nightmares
Jan 22, 2009 @ 18:51:50

Jani Hartikainen has posted about three simple, but hard to find, mistakes that can cause you endless frustration if you're not looking in the right places.

Here's his list:

  • Semicolon after a while - a small problem with big (infinitely looping) consequences)
  • empty() and magic __get method - __get will hit first, then empty
  • Missing semicolon after break or continue - a classic that can make switches and evaluations difficult to debug

Comments on the post include a few others: working with variables by reference, comparisons with == versus === and strpos finding the first character in a string.

tagged: mistake semicolon empty magic break continue debug nightmare

Link:

Kore Nordmann's Blog:
Evil bugs in your code
Dec 04, 2007 @ 17:52:00

Kore Nordmann has made a quick post to his blog about some "evil bugs" he's seen reoccurring in the code he writes and wanted to point them out so other developers might learn from them.

Those are 4 typical errors I introduced in my code, and spend some time debugging it, because I found them really hard to spot. Luckily, once I spotted the actual bug, I find it a lot easier the next time the typo occurs. Therefore I want to share those, so that I may save you some minutes of your life hunting stupid bugs.

His three contributions concern a "missing if", the addition of a random semicolon, operator precedence and a for loop that refuses to work. Others have contributed to the comments on the post as well.

tagged: bug if semicolon operator precedence loop bug if semicolon operator precedence loop

Link:

Kore Nordmann's Blog:
Evil bugs in your code
Dec 04, 2007 @ 17:52:00

Kore Nordmann has made a quick post to his blog about some "evil bugs" he's seen reoccurring in the code he writes and wanted to point them out so other developers might learn from them.

Those are 4 typical errors I introduced in my code, and spend some time debugging it, because I found them really hard to spot. Luckily, once I spotted the actual bug, I find it a lot easier the next time the typo occurs. Therefore I want to share those, so that I may save you some minutes of your life hunting stupid bugs.

His three contributions concern a "missing if", the addition of a random semicolon, operator precedence and a for loop that refuses to work. Others have contributed to the comments on the post as well.

tagged: bug if semicolon operator precedence loop bug if semicolon operator precedence loop

Link:


Trending Topics: