Hacker News new | ask | show | jobs
by tombert 2720 days ago
I haven't used PHP in around 6 years (running PHP 4 I belive); has the language improved ? My biggest complaint was that the API was incredibly inconsistent, but that seemed like it could be improved in later versions if they weren't afraid of breaking backwards compatibility.
8 comments

One of the best things of PHP today is the ecosystem. The PSR [0] interfaces let you build your own framework using libraries from the major frameworks or independent libraries seamlessly.

[0] https://www.php-fig.org/psr/

I have been using PHP for a new job after not using it since PHP 4 too but I was also a very immature dev back then. I quite like it. It's not perfect and it still lacks some things but it's very easy to put something together. I think that my biggest problem is actually that it's too easy, which makes some people write code that it's a bit too sloppy and hard to understand, creating a possibly huge technical dept.
PHP 7+ is a totally different world from 4. It’s actually a real programming language now. The massive API redundancy is still there, but you have classes, namespacing, etc.
Also adding libsodium directly into PHP core as of 7.2 was a big step in the right direction IMO.
Yes, including today's merge of property types:

    class A {
        public int $id = 0;
        public ?Foo $somefoo;
    }
The language has evolved slowly but surely, and it's now much harder to make obvious mistakes thanks to a bunch of good-quality static analysis tools (one of which I authored).
There have been a number of improvements in the latest PHP versions, especially in terms of performance.

There's still artifacts of past PHP versions that are there, though, which makes it far less nice to use than something more modern.

It was likely PHP 5. The last PHP 4 release is more than 10 years old [1].

Later versions of PHP 5 were worlds apart from version 4.

[1] http://php.net/supported-versions.php

I'm pretty sure it was 4, the company I was working for was...let's just say "slow to update", which is partly why I left.
It has improved a lot in that time and I find it decent to work with now that there's decent dependency management with Composer and a good Rails-like framework in Laravel.
PHP 7 is a very different (better) language compared to 4. You can write very good quality code with it now.