PHP case sensitivity @#&^%!

The other day I finally figured out why some people are so violently opposed to PHP. When using object oriented features of PHP5 I discovered the hard way that PHP has some weird, backwards compatibility issue rules how it handles case.

In a nutshell, variables are case sensitive, but function names, and object methods (!!!) are not.

That explains why the following code does not work

class A {
GET($url) {
// retrieve the url
B extends A {
private var

get($var) {

I know, this case could be handled with __get or __call, but still, it doesn't hurt to know that $this->get and $this->GET are one and the same, as far as PHP5 is concerned.

Your rating: None Average: 1.5 (2 votes)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
I was confused as well by amosbatto (not verified)