Why PHP might just have saved itself, but is it in time?
May 17, 2021
#php #php8

Why PHP might just have saved itself, but is it in time?

Nowadays the popular opinion is to dislike PHP as a programming language. This is mainly because of itā€™s past. Despite this hate itā€™s by FAR the most used language out there for developing the web.

So whatā€™s the problem people have with it and why might this not be as big of a deal as the angry bloggers of the world want to make you believe.

Hate from the past

PHP as we know it today is a far successor of a hobby project by Rasmus Lerdorf. Back in 1994 Rusmus was building his personal site in C, and he was in need for toolkit to make coding his website easier and more swift. Therefore he started building a toolkit which he called PHP/FI. One year after starting this toolkit he released the code as an oupen source toolkit. It looked something like this:

<!--include /text/header.html-->

<!--getenv HTTP_USER_AGENT-->
<!--ifsubstr $exec_result Mozilla-->
  Hey, you are using Netscape!<p>
<!--endif-->

<!--sql database select * from table where user='$username'-->
<!--ifless $numentries 1-->
  Sorry, that record does not exist<p>
<!--endif exit-->
  Welcome <!--$user-->!<p>
  You have <!--$index:0--> credits left in your account.<p>

<!--include /text/footer.html-->

Itā€™s far from what weā€™re used to today. But hey, weā€™ve got to start somewhere right?

From here PHP knows a steady- yet at times a bit turbulent history. Led by people as Andi Gutmans and Zeev Suraski (aka Zend; this might ring a bell for some).

I really donā€™t like programming. I built this tool to program less so that I could simply reuse code ā€¦ I donā€™t know how to stop it, there was never any intention to write a programming language [ā€¦]. I donā€™t know how to write a programming language at all, I just kept adding the next logical step. ā€“ Rasmus Lerdorf

Inconsistent and questionable design

Probably most of the criticism which I -letā€™s by honest- share to some extend is the fact how the language is not typed. From insiders thereā€™s also a lot of criticism on the naming inconsitency of functions and classes. Part of this is what might make the language somewhat unpredictable at times.

If youā€™re looking for a good old bash at PHP, thereā€™s probably nobody on the internet who burned it more than this guy. Or maybe this one, you pick.

PHP produces bad code

One of the most heard comments about PHP is that it produces bad code. How can a language on itā€™s own produce bad code? And is this really true?

Is it possible that PHP is just used A LOT (over 80% of all web development) and that itā€™s for a lot people the first language they learn?

Since PHP is used a lot, itā€™s also a very accessible language for people who just get started. The freedom the language gives because of itā€™s lack of type safety and restrictions really helps here.

If PHP would produce bad code would companies like Facebook, Yahoo, Wikipedia Flickr, etc. be trusting on it for their platforms?

Like with on any other language, you have to make it work.

Is PHP dying?

For over a decade people have been saying PHP is going to die and yet itā€™s still at the top of the ranks. Yes thereā€™s some new kids on the block, but theyā€™re nowhere near throne of PHP and neither will they anywhere in the near future. Will it be on the throne forever? Thatā€™s a good question.

Whatā€™s next for PHP

PHP keeps evolving, primarly fixing the major criticism on it not being type safe. Starting from the later PHP 7 versions, and building on this in PHP8 type safety is really taken on the next level by PHP. Iā€™m personally really hyped about the latest PHP versions as I believe it really may secure theyā€™re spot in the market for the years to come. Will they make it another decade on the throne? Iā€™m not too sure, but PHP is definitely not about to leave anytime soon.

Ps. PHP8.1 has some great stuff coming up too. Check it out here.