PHP is the Harry Potter of programming, and why that’s an amazing thing.

My Senior year of High School I engaged in holy MySpace warfare with my then English Teacher over the legitimacy of Harry Potter as a literary work (oh, the 2000's). Trained by University to mine for metaphor and pontificate the perils of prose, she lept to showcase an obvious lack of complexity which inhabit works “clearly for children.” Only through a journey to find an author’s true meaning, she argued, can you appreciate the life changing messages buried deep in the pages of history’s finest novels.

Like any self-respecting Gryffindor, I was quick to defend my fictional friends (we had grown up together, after all). “Take me as an example! In a world of TV and video games, Harry Potter is the one book that finally convinced me to sit still, shut up, and read. If inspiring millions of kids to turn off the TV and escape into a novel the size of a phonebook isn't of literary merit.. well then I can’t guess what is.”

Her rebuttle was as succinct as it was scarring: “Millions of people read the comics too.”

Never challenge the written whit of a liberal arts major.

In the end no clear victor emerged… though my final grade didn't suffer in retribution, so I suppose that’s victory enough.

If you’ve circled the programmer’s hangouts for the past few years then there’s one meme I’m sure you’re familiar with: PHP is the devil, and if you use it regularly you should feel bad about yourself and your life choices (perhaps that’s a slight exaggeration, but only slight).

There are a lot of things which cause the religion of PHP to have few followers, especially when held up to the monumental likes of Java and the C’s. It can be a confusing and disorganized language. Its forgiving nature lends to problems reminiscent of Internet Explorer: an infamous quest to render what it thinks the developer wanted, instead of strictly what they typed.

That same forgiving nature is what many hold as evidence in the debate that PHP (and languages like it) make poor tools with which to learn programming for the first time:

  • It fails to establish key principles like efficiency and memory management
  • It completely abstracts variable types and method returns
  • It encourages the melding of view code and business logic
  • It provides powerful tools for global variables, and in doing so hides potentially disastrous security ramifications

A language like C has none of these problems. It’s pure, it’s rigorous, and it provides the most stable of foundations. With C you’ll learn proper memory management, see the ramifications of bad optimization, and understand every primitive’s place in the world — or, by god, you’ll go down trying.

If languages were teachers, C would be the strict authoritarian. Every expectation must be met, every problem solved, every lesson burned into your mind. You’ll hate C everyday until you graduate, look back, and realize you’re the better for it.

PHP, on the other hand, would be the cool teacher that everybody liked. They focus less on form and more on function. Critical application bows itself to creative interpretation. Some students would get the easy A and move on. Others would find a life-long passion they never knew they had.

And that’s the crux, isn’t it? Motivation is a funny thing. Do you start from a place where only the strong will survive? Or do you lure people in with a taste of the things they will one day do?

Like Harry Potter sparked literary intrigue, so did PHP spark my love of programming. Before I had ever taken a calculus class or balanced a binary tree, I wrote web games and image uploaders. I stood before my computer as its master and commander. There was nothing I couldn’t tell it to do (or so I thought at the time). And, even while the computer begged for more memory and cried over lost CPU cycles, I became more and more hooked.

This type of inspiration isn’t new or novel. From children’s books to chemistry lab explosions, we have cleverly devised ever-more-creative ways of conning those poor unsuspecting kids into pursuing a passion they might not have otherwise considered., a phenomenal initiative to get kids interested in programming at an early age, teaches principles in broad strokes using games and logic puzzles. They don’t lead with C for the same reason we don’t ask 5th graders to dissect Dickens.

But with all these clever tricks we find ourselves with an unavoidable question: Can you repair a rocky foundation if you’ve already started building the house?

There are two things I think most great programmers will agree upon: (1) TNG was superior to TOS and (2) you will never succeed in this industry if you are immutable in your ways. Like our friends in academia say “Publish or perish” we can say “Adapt or atrophy.”

Patterns are constantly emerging, thinking is constantly evolving, and “standards” are constantly multiplying. Even those of the strongest convictions are forced to always update their thinking. Is it any less reasonable to expect the same of someone just getting started?

In the early days of your pursuits you’re impressionable. You learn more and more and your world view changes. You learn that this giant thing you’re standing on is round, not flat. You keep asking “Why?” until you’ve learned about planets and orbits and euclidian geometry. You still know the thing you’re standing on is, for all your purposes, flat — but now you know why it seems flat and how it can possibly be round.

Programming is no different. PHP serves as a shortcut into a world where you can instantly satisfy your insatiable need to problem solve and create. It’s a safe place. Your sandbox to learn the fundamentals. Maximize the fun, minimize the frustration. You’re unhindered by not knowing just how harsh and unforgiving the world you’ve ventured in to can truly be. Don’t worry, you’ll get there — but when you do you’ll have by your side the knowledge of how rewarding that pursuit is.

Just as the pages of Harry Potter transported millions to a magical place of unending possibility, so does PHP let you peer into a world of intriguing problems and infinite creation.

It inspires you with possibilities, infects you with ideas.

Now, if it only came with a wand.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.