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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: