PHP as a Beginner Language?

“I’d rather claw my eyes out than spend a day using PHP.”

Ask an experienced developer what they think of the language, and you might get a response like this. Okay maybe not that extreme.. but the resentful sentiment towards the language by a large number in the programming community is clear. Often the butt of jokes.. there comes a point when you start feeling bad for poor PHP. Most programmers love it or despise it.. there’s seldom room in the middle. So before I continue, let me say that PHP was the first server side language I learned. I have a soft spot for it. I’m a little biased- sure. But who isn’t.

I certainly acknowledge PHP’s quirks and shortcomings.. but I’m here to defend it as a good first server-side language for beginners.

 

The Bad

To start, I’ll explain why PHP has a bad reputation.

The biggest reason people hate PHP is it’s just plain ugly to look it. With opening and closing php tags, dollar signs, and echo statements all over the place.. it’s enough to send most heading for the hills before they give it a chance. And heaven forbid you miss a semi-colon somewhere.. your app will crash. Many developers complain that writing code in the language just feels clunky and bulky.

Besides the headache it may give people to look at, there are some seriously bad design practices. First and foremost, PHP is notorious for SQL injection (an explanation here). SQL injection is a very bad thing, however PHP 5 introduced prepared statements which solves this problem.

There are plenty of articles outlining why PHP sucks (try this one) so I won’t go into too much detail.. but those are the main reasons.

 

The Good

Earlier I mentioned PHP was my first server-side language, but it wasn’t the first one I tried learning. I started with Ruby on Rails, and Angular before eventually giving PHP a try. I found both languages/ frameworks to be super confusing for a beginner. Not to mention just getting setup with a development environment for each can be a daunting task for a beginner.

The main reason I would recommend PHP to a beginner is that in my opinion, it’s the easiest language to get started writing code. From setting up a dev environment, to viewing a hello world application, it’s by far the easiest and least time consuming. Which is a big deal to people who don’t know what they’re doing. It’s so easy to quit before you even get started, and with PHP, the chances of that happening are the least compared to other languages.

Another thing experienced people forget.. it is so easy to just see your results of a php application on a web page. All you have to do is throw in a little echo statement with some text, and refresh the browser. Painless work to see your results, which is more than I can say for a Java application for example.

In my mind, there’s no doubt it’s the easiest language to connect to a database, and see how real life applications work and interact with data. So many of the frameworks shield you to things like routing and application state, which php does not. This is probably not a good thing for advanced developers, but for beginners it’s important to learn and understand those concepts.

Developers with client side web experience will especially find php more natural than other frameworks or languages. You can easily visualize how server side code and data will integrate with a user interface (HTML).

Lastly, there is sooo much more opportunity out there for entry level developer jobs/ projects in php vs any other language. It’s easier for a beginner to get real world work experience if he learns php vs any other language. Which is crucial to accelerate a developers learning progress. The earning potential isn’t as great.. but it’s not like you have to be married to php forever.

 

Conclusion

Although it’s not a sexy language, I think beginners looking for some direction on what to do next after learning front-end technologies should try to tone out the rambling criticism of disgruntled developers and take a closer look at php. It’s ugly, but in a cute way 🙂

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *