So can i just jump out and say here that despite php’s popularity, there is some aspects of php that’s just plain ‘ol stupid. Oh, I’m aware that i prefer ColdFusion, the thing I’ve know for nearly 15 years, and no, I’m not fighting “adapting” to new stuff. Quite frankly, php is overall just as intuitive as any other language – in fact it’s pretty easy – but I’m by no means impressed… why not? for starters, there is very little in PHP that I couldn’t have done in ColdFusion 4.5 in 1999. It doesn’t really change things, only that “it’s free” – what can i do in php that is so fundamentally unique? At least ColdFusion wraps up common web programming paradigms into simple tags and had a vision of making web programming less tedious. Php doesn’t do any of that and overall, it’s just mediocre. and then a few little things, the place where they could have made a difference – well, they didn’t make that difference. These are (3) little details that just got swept under the carpet and i think it stinks.
Stupid #1: $
Somebody must have watch too much Jerry Maguire with the “show me the money” quote all stuck in their head when they decided that all variables in php have to start with a $ character. Ok, really it’s because php has it’s roots in perl. Either way, it’s 2011 and i have to start all my variable names with a wasted character? don’t like it.
Stupid #2: . (that’s a period)
The nice thing about standards is there are some many to choose from. In this case, a very well know paradigm, “dot notation”, as the entire code writing world population has known for a hundred million years, was completely subverted in order to use the “.” character as the concatenation operator.
Philosophically, this doesn’t even make sense: a period punctuation mark represents the stopping of a thought, not the concatenation of one. i *could* have understood the “&” (ampersand) character (like ColdFusion uses, even though that was pretty damn stupid too, but then again, CF did it in 1994, long before xml encoding was the norm) At least the “&” character reads “and” and somehow suggests concatenation. I can understand why, perhaps, the php Gods couldn’t overload the “+” sign, like the entire rest of the God fearing languages in the world use. Hell, even a semicolon would have been disastrously better than the “.” character; Yes, a semicolon you already are thinking would be a major problem in that it’s normally used for the end-of-command indicator – it’d be a major issue. So, why then, is a period so awful? see Stupid #3
Stupid #3: -> (the “arrow”)
If you “cut yourself off at the knees” it’ll not only be hard to walk, it’ll be next to impossible to run. One of the most common patterns in coding, “dot-notation” for associative arrays was completely cut-off by Stupid#2; So out rolls the duct-tape and the beginning of the a-standard; the birth of “the arrow”. who wrote this language, Robin Hood? Perhaps, the “rob from the rich, give to the poor” grudge of the commercial application server marketplace that has driven the mainstream adoption of php has morphed into an “oh well, it’s free!” mentality and let this kind of syntax monstrosity come to life. Instead of being able to reference an associative array like this: $_GET.first_name i have to use this “shortcut” syntax: $_GET->first_name. hey peeps, this is not a shortcut and using an html character like the “>” character is a really crappy idea in a scripting language (i do have that beef with the & character in ColdFusion). for now, i’ll just stick with the old bracket notation $_GET[“first_name”] and live with it. unfortunately, i have to read other people’s code.
Someday I’ll get over it, but for now, you may hear more grumbles…