PHP and undefined variables

I wish software wouldn’t fail silently.

At work I was recently assigned to a project using PHP which I’d never used before. I used Google a lot and never had trouble finding out how things worked. But there is one thing that exasperates me. If you use a variable that hasn’t been defined PHP doesn’t tell you. Misspell a variable name? Instead of finding out at compile time (C/Java/etc) or when you try to use it at runtime (Python) you have to figure it out for yourself. Something you should be able to fix in a minute can become a frustrating search through your code.

This is a bug in the language design.

Advertisements

%d bloggers like this: