
The Future of PHP - kiyanwang
https://medium.com/better-programming/does-php-have-a-future-6756f166ba8
======
deanclatworthy
It’s exhausting seeing these kinds of discussions. The only people who think
PHP is dying is those who don’t use it. Besides the languages quirks, it’s
incredibly productive and has a huge community of well engineered libraries
for almost all mundane tasks. Theres great testing tools and general quality
tool alike PHPStan. There’s an enormous pool of talent to hire from.

I code mostly in node nowadays, not through choice but due to the language
snobbery I encountered during the last few years. It’s a shame. I find myself
far more productive in the synchronous model than trying to bend my mind
backwards with closures and async issues in the node world.

~~~
deragon
>The only people who think PHP is dying is those who don’t use it.

That is absolutely not true. I didn't care about PHP at all when I didn't use
it. Then I got a job where I had to use it (and the management didn't want to
hear about changing it), and I started slowly disliking it. Then I got out of
that job and again mostly forgot about it and curretly don't really care what
happens to it.

Weird defences like yours resurge the dislike, so there seems to be some
amount of lingering trauma. And of course there's the worry that the more
popular PHP is, the more probable it is that I will have to face it again some
day.

~~~
colshrapnel
So, given you "don't care what happens to PHP", I assume you don't give much
heed to whether it's winning or dying. That's basically what @deanclatworthy
is saying, so there is nothing to fight about. Cheers!

~~~
deragon
I'm not fighting, I just gave a single data point that invalidated (logically,
not actually) one part of his argument (the one I quoted) :) And then a bit of
commentary.

~~~
monooso
The argument isn't that _every_ person not using PHP thinks it is dying. As
such, I don't see how your response invalidated it.

Also, the statement "that is absolutely not true" should probably be backed up
by more than your single data point.

------
firasd
As far as prominent products, besides WordPress, Facebook, and Wikipedia,
Slack and Mailchimp are (were?) also PHP. (I googled and apparently a
prominent '-hub' site uses it too.)

The PHP hate never made sense to me in the context of the rise of Node.js:

* In PHP I've never accidentally combined 2 + 0.3 into 20.3

* I dislike the cowboy-ish over-use of ternary operators and short-circuiting by JS devs (random example from StackOverflow: _var bar = data.bar !== undefined ? data.bar : 'default';_ )

I appreciate that JS has functional-programming aspects that make it appealing
though.

It's interesting that when PHP alternatives like Rails came around I saw a lot
of anti-Java sentiment online, but now when Rails-based companies have to
scale they end up using Java or JVM-based infrastructure. So trendy online
sentiment shouldn't really inform best practices for various teams at various
stages. (I notice that a lot of NoSQL hype seems to have died down since
2015...)

Perhaps the best commentary about why people succeed with PHP is this HN
comment from a couple years ago:
[https://news.ycombinator.com/item?id=12704094](https://news.ycombinator.com/item?id=12704094)

 _If you 're programming in PHP, you're not running around talking about
"convention over configuration" giving talks, or trying to make your code
beautiful... You're incorporating feedback while the other guy is just
starting to get to work. When he finally fails, he's used up half his runway,
whereas you, the guy who didn't give a fuck about your code has gotten past
that first failure, and are finally getting some traction._

~~~
wildduck
I have being using PHP since it was call PHP - Personal Home Page. The best
part of the PHP is the templating! It makes a lot more sense then Perl at the
time. Now days templating can easily be replaced by EJS.

Personally I wouldn't want to use any language that does not have closure and
function as a first class citizen. It makes programming fun and productive.

BTW, the 2 + 0.3 thing you are mentioning are all fixed by ES15 and ES6.

~~~
adventured
> The best part of the PHP is the templating!

I've used PHP for about 15 years give or take, off and on. Before that I
variously used Perl, ColdFusion or ASP for fairly routine Web services. Mostly
I use PHP for straightforward CRUD work, for which it is very well suited. I'm
currently using it for what is effectively a glorified CMS system. It's
perfect for the task, I essentially never encounter something in PHP that
causes me consequential problems within the lane that I'm using it. Although
had they not dramatically boosted performance with the 7 releases, I might
have opted for something else at this juncture.

------
bennyp101
No.

As much as everybody likes to hate on PHP, it powers a lot of services that
are used all around the world - and a lot of internal systems.

With 7.3 it seems as though PHP has finally got to a point where it knows who
it is and where it's going - don't get me wrong, it's paid my wage for the
last 18 years - but it's also made it very easy to shoot myself in the foot.

With frameworks like Laravel and Symfony about now, I can only see it getting
stronger.

(Although I'm moving to more Elixir and Phoenix, I still pick PHP for simple
projects, or those that I can't use Elixir on - and obviously maintaining and
upgrading existing things)

~~~
jjeaff
Even if php stopped being used in all new projects today, people are still
hiring for cobol projects.

The number of php projects now is orders of magnitude more than cobol in it's
heyday.

There are going to be plenty of php jobs for quite some time.

~~~
jarfil
Probably true, but also COBOL usually encodes the business logic, which is
much harder to throw away and rewrite from scratch, than any presentation
layer written in PHP.

------
Isinlor
It's like Quora.com:

\- Is PHP dying in 2019? (25 Oct 2018) \- Is PHP dying in 2018? (27 Apr 2018)
\- Will PHP die out in 2017? (24 Mar 2017) \- When will PHP finally die? (13
Feb 2017)

I asked people at Metaculus (a forecasting website) "When will PHP die?". The
current consensus out of 43 predictions seems to be 50% chance before Jan
2037, 75% before Feb 2051. Seems like a reasonable prediction.

If you are interested in making your own predictions:
[https://www.metaculus.com/questions/1691/when-will-php-
die/](https://www.metaculus.com/questions/1691/when-will-php-die/)

------
thomasedwards
I’ll save you the bother of reading 966 words:

No, it’s not.

To me, it’s never been a better time for PHP.

~~~
rogem002
Recently I was asked to help out with a PHP project for work, I made the
switch to rails almost a decade ago & haven’t looked back since so I was
excited to see how PHP felt.

I was fairly impressed with how easy it was to jump back to PHP, the
documentation is full of examples, there is composer for package management
and it has a strong community who meets up regularly.

~~~
downtide
Exactly. Composer is key here. Pear just didn't work well as a third party
bolt on. As a result monolithic frameworks such as Zend Framework were born,
along with Blogs, come CMS come frameworks. And Rails clones. It's still hard
to navigate the 3rd party landscape, but integration is so much easier.

My main gripe with Php is editor support. Jumping around a code base is hard
when you introduce slightly abstract class loading. The more 'typed' the
language is, I guess makes editor help easier, with auto completion etc. But
that is a disjoint or me.

Editor support for functions is useful. I'm slightly embarassed still at the
frequency of my manual lookups.

Class autoloading is nice, but functions are left by the wayside on the
autoloading front, which is a bit gnarly.

The language is actually quite quick to learn, and you can hold a lot in your
head. You can do a lot just with arrays and foreachs, without having to reach
into convenience functions.

Most of my time is laboured over other frameworks and interoperability, rather
than any really worry about Php itself.

~~~
LeonM
> My main gripe with Php is editor support. Jumping around a code base is hard
> when you introduce slightly abstract class loading. The more 'typed' the
> language is, I guess makes editor help easier, with auto completion etc. But
> that is a disjoint or me.

If you are comfortable with IDEs, I strongly recommend PHPStorm. It is the one
piece of software that I happily pay for each year. It increases my
productivity and quality control to such degree that I wouldn't want to write
PHP code without it.

> Editor support for functions is useful. I'm slightly embarassed still at the
> frequency of my manual lookups.

I've been writing PHP for 10 years now, and I still have to look up just about
every function. I only recently discovered that PHPStorm supports displaying
the PHP manual as you type, but that it is disabled by default.

------
nallerooth
I've been really impressed by the performance improvements made during the
last couple of years. I guess my main issues with the language is the non-
uniform naming of functions and the ordering of their parameters.

At some point, I'd like to see a new major release that deprecates all of
those old problems in order to clean stuff up. Even if it means breaking
backwards compatibility a year or two later on.

It turns out, however, that such things aren't easy to handle. Python 2 to 3,
anyone?

~~~
fetbaffe
Differences in naming & parameter order for the PHP standard library functions
are because they are usually just a thin layer above a C library, therefore
are consistent for that C library (e.g. string functions), but not between
libraries. Would it really make sense for PHP to standardize between C
libraries?

------
reustle
According to this interesting Google Trends chart

[https://trends.google.com/trends/explore?date=all&q=python,p...](https://trends.google.com/trends/explore?date=all&q=python,php,ruby,javascript)

Python is on a quite strong climb, with PHP falling significantly over the
years. But, it also says Javascript is on the same trajectory so that shows
the real value of the data.

~~~
rokalakt1337
There are many fresh graduates coming out of uni thinking Python is the next
big thing. But once they realise companies don't want to invest in re-
inventing the wheel, they will one way or another have to learn some PHP.

------
dpau
Like many I've worked in lots of languages over the years and enjoyed the
benefits, challenges and quirks of each one. But when I want to get a web
application idea up and running I almost always reach for Laravel. It's the
cleanest and most feature-rich application framework I've come across. I don't
really care that it's written in PHP. All I know is that it's rock solid and
gives me tons of infrastructure built-in. (I should note, though, that for the
past couple years I only use Laravel for the back-end, and Vue for the
interface.)

------
joelbluminator
Rails developer based in the Netherlands. I wish there were 50% as many
Ruby/Rails jobs as there were PHP jobs here, mainland Europe is crazy about
PHP for some reason.

------
gerardnll
I feel like I see this topic pop up every few months, pretty tired, and the
article itself doesn't offer anything new or worthy data...

I feel that PHP is here to stay and future releases like 7.4 and 8 are going
in the good direction. I'm pretty happy with the health of the ecosystem and
how the language has improved over the last years.

------
krapp
If effing C and COBOL are still around and Javascript somehow turned popular
as a general purpose application language then PHP isn't going anywhere.

~~~
valand
C is coming back. Seeing rust is rising and its interoperability with C is
pretty nice.

JS is almost general purpose these day. Just a bit more push to optimizations
on JS engines.

------
Paturages
Curious on how much of the 34% actually uses PHP >= 7.

As long as there's legacy, PHP jobs are not going to run out for sure, that's
a given. I wouldn't exactly mind carrying a project in PHP >= 7, but I
wouldn't wish to get a job in PHP < 7 territory personally.

~~~
mpol
Looking at the WordPress statistics, about 60% of WordPress websites runs on
7.x. I can imagine for dedicated servers that run PHP frameworks, that
percentage is higher.

[https://wordpress.org/about/stats/](https://wordpress.org/about/stats/)

------
jonplackett
This whole article reads like a search engine optimisation piece.

~~~
valand
Upvoted because 1. you're funny and 2. it's true

------
tannhaeuser
I'm hearing a lot of praise for PHP frameworks such as Laravel, but I'm not
sure PHP should strive to become more like RoR and Node.js. Rather, PHP's
unique selling point, for me anyway, is its use as embedded language in
otherwise static HTML pages via SGMLish processing instructions (`<?php
...>`), and I think there's nothing wrong with that even with the current
preference towards Ajax and (micro)services. It's just that embedded PHP did
such an incredibly poor job (like, not even an attempt) of preventing
injection attacks despite SGML having very strong mechanisms for context-
dependent escaping and markup validation. Which has given PHP its bad rep as a
botnet/DDOS vector, and deservedly so since this has become a long-standing
problem for PHP and non-PHP sites alike.

~~~
Isinlor
Mixing PHP, SQL and HTML is ok for 200 lines apps. It does not scale to even
10 000+ lines of code and no one is doing that anymore.

Some people are still using PHP just as a template language, but there are
still issues with XSS, that one could avoid by default with dedicated template
languages like Twig.

Current main selling point of PHP are great frameworks and ecosystems, easy to
find developers, and share nothing architecture that removes whole class of
problems related to memory leaks and scalability.

------
laurent123456
I'm not sure I'll start a new project using PHP these days (though the latest
Symfony is very good), however I still frequently uses it as a scripting
language, as an alternative to Bash. It's perfect for this, easy to use, and
can scale to large scripts if needed.

------
pavlik_enemy
It’s not dead but there’s no point in learning it if you don’t know it
already. Pretty much every language used for web development is better than
PHP. Python is more consistent and has better support for async code.
JavaScript can be used on backend, web and mobile, Java and C# are faster and
have better typing

~~~
thinkindie
Javascript better than PHP - I doubt. There are several solution for having
Node.js style PHP too and they are doing great, see reactphp and alike

------
tylerjwilk00
You either die a hero, or you live long enough to see yourself become the
villain.

~ Batman

------
maitredusoi
For me PHP is exactly like IE6, it completly shaped web programming as we know
it, and will have a true resilience, before dying, inevitably (disclamer: I
used PHP from 2000 to 2009 , then switched to rails on a daily bases).

~~~
thomasedwards
You may want to take a look at Laravel.

~~~
VvR-Ox
And when you understood how it works you may want to try Symfony. Laravel also
uses some of their libraries.

