Live data from Hacker News

PHP 7.2.0 Released

php.net

51–60 of 80 posts

Re: PHP 7.2.0 Released

#51
post #45
post #43

Earlier quoted context omitted.

How fast is a hello world in node.js to you? I forgot to mention my formerly favorite language: Python. It's _much_ faster than Node.js in startup and relatively basic things. Node wins on almost everything I make, though. $ time python test.py # second run hello world real 0m0.009s user 0m0.009s sys 0m0.000s

Best times from a few "do nothing" runs of Node: $ time node -e '' real 0m0.098s user 0m0.084s sys 0m0.010s Of course on my desktop it's a $ time node -e '' real 0m0.002s user 0m0.000s sys 0m0.000s tiny bit different. Python on my laptop is just slow enough that I really notice it: $ time python -c '' real 0m0.032s user 0m0.022s sys 0m0.009s Of course PHP is all 0.014, 0.010, 0.012, etc. Incidentally, this T43 is a b…

It seems almost all the time node.js runs hello world is spent loading its own modules. You should try something like this:

    // watch.js
    var file = process.argv[2]
    console.log('press enter to run '+file)
    process.stdin.on('data', function(){
        var [s1,ns1] = process.hrtime()
        for(var k in require.cache) {
            delete require.cache[k]
        }
        require(file)
        var [s2,ns2] = process.hrtime()
        var s = (s2-s1)+(ns2-ns1)*1e-9
        console.log('time: ' + s.toFixed(9))
    })
Result: less than 1ms on first run

    $ node watch.js ./test.js
    press enter to run ./test.js

    hello world
    time: 0.000952656

    hello world
    time: 0.000284171
edit: script now deletes all cache, not only the passed script (result is the same if the script doesn't require others)

Re: PHP 7.2.0 Released

#52
post #27

Earlier quoted context omitted.

> although one could argue that PHP is still slightly better in terms of speed of deployment It takes less than a minute to deploy apps on heroku/whatever. Deployment speed is not really a relevant factor now, everything is fast.

Is there an equivalent of something like WAMP, but using Heroku?

These are two completely different things...

WAMP is a Windows web development environment; it is a simple way to install / run Apache2, MySQL, and PHP on your Windows machine for local development.

Heroku is a deployment solution which packages an app’s code and dependencies into virtualized Linux containers that are designed to execute code based on user-specified commands.

Re: PHP 7.2.0 Released

#53
post #21

Earlier quoted context omitted.

> What is PHP like nowadays? Would anyone recommend it for new projects? It is not bad at all but since there are so many good/better alternatives I would never start a fresh project with PHP nowadays. The only reason would be if you have a team with PHP experts - then PHP would be the obvious choice.

I don't know whether the alternatives are objectively better, except maybe in certain domains. Mostly, people seem not to like PHP because they find it ugly and awkward... which is valid, but subjective. The major alternatives (JS, Ruby and Python) have documentation, frameworks and reasonably comprehensible paths to an MVP, although one could argue that PHP is still slightly better in terms of speed of deployment. E…

> PHP is still slightly better in terms of speed of deployment

When it comes to securing the deployment I think Python/Ruby would be better though - if you factor that in I would say it would be faster for me to deploy a python app than configure php to be secure.

Re: PHP 7.2.0 Released

#54
post #28

I use Hack now (I work for Facebook) and i kinda like it, at least in comparison to any untyped languages. So, serious question... Is there really any reason to use PHP over Have?

A very large percentage of the popular packages have ceased to concern themselves with Hack compatibility, so as the languages continue to diverge, the benefit of Hack taking advantage of the PHP package ecosystem will decrease.

Re: PHP 7.2.0 Released

#55
post #37
post #18

Earlier quoted context omitted.

The kind of worn out ecosystem is my main dig with PHP. A couple parts of the ecosystem are outstanding, especially laravel, though laravel’s DId internals are a maze. (side note: Not a fan of DI being more or less required - it’s necessary for testing but the pattern is just a mess. Lack of static typing makes PHP kind of mediocre at DI, too) Outside of that there’s a ton of abandonware or just generally unmaintaine…

Having used both Laravel and Spring, I don't see Laravel being much worse at DI. Spring is just doing everything by Strings anyways, so if you're going to get failures they'll still be at runtime.

Spring is certainly crazy with DI too. It's just rough to follow Laravel internals the times I've had to do it.

Re: PHP 7.2.0 Released

#56
post #44

Earlier quoted context omitted.

For new projects only if you have an established php team / related projects. Modern OOP development in PHP 7 feels basically like an older version of Java (pre Generics), solid for engineering, but ugly for anyone who expects newer language features.

Agreed. We use PHP for automation scripts (this decision was made a long time ago). In terms of features it's a good language but it's not fun to work with.

I think the mix of static typehinting and dynamic language is actually kind of well balanced now in version 7, but maybe that's just me leaving ruby's magic behind after many years and happy about IDE support and static checks ;)

Re: PHP 7.2.0 Released

#57
post #8

It's weird for a bug fix I wrote to be top of the list of features. PHP 7.2 is not the most eventful release.

Yes, strange for a bug fix to be top of a list of features, however... I don't agree that it's "not the most eventful" release:- libsodium being included into the core is a big tick in the box in terms of maturing as a language; modern - secure - cryptography out of the box.

I'm surprised PHP hasn't had this for a while. Isn't PHP nearly 20 years old? Is it common for web languages to grow so old before they get crypto in the standard library?

Re: PHP 7.2.0 Released

#58
post #45
post #43

Earlier quoted context omitted.

How fast is a hello world in node.js to you? I forgot to mention my formerly favorite language: Python. It's _much_ faster than Node.js in startup and relatively basic things. Node wins on almost everything I make, though. $ time python test.py # second run hello world real 0m0.009s user 0m0.009s sys 0m0.000s

Best times from a few "do nothing" runs of Node: $ time node -e '' real 0m0.098s user 0m0.084s sys 0m0.010s Of course on my desktop it's a $ time node -e '' real 0m0.002s user 0m0.000s sys 0m0.000s tiny bit different. Python on my laptop is just slow enough that I really notice it: $ time python -c '' real 0m0.032s user 0m0.022s sys 0m0.009s Of course PHP is all 0.014, 0.010, 0.012, etc. Incidentally, this T43 is a b…

Python is faster on my laptop.

    time php -r ''

    real	0m0.064s
    user	0m0.055s
    sys	0m0.007s

    time python -c ''
    real	0m0.021s
    user	0m0.011s
    sys	0m0.005s
These startup metrics are also super arbitrary anyway, as in web servers code loading is behind your app server anyway (uwsgi, php-fpm, whatever).

Re: PHP 7.2.0 Released

#59
post #53
post #21

Earlier quoted context omitted.

I don't know whether the alternatives are objectively better, except maybe in certain domains. Mostly, people seem not to like PHP because they find it ugly and awkward... which is valid, but subjective. The major alternatives (JS, Ruby and Python) have documentation, frameworks and reasonably comprehensible paths to an MVP, although one could argue that PHP is still slightly better in terms of speed of deployment. E…

> PHP is still slightly better in terms of speed of deployment When it comes to securing the deployment I think Python/Ruby would be better though - if you factor that in I would say it would be faster for me to deploy a python app than configure php to be secure.

That's probably true - other languages benefit from learning from PHP's mistakes and requiring a framework to begin with to enforce a lot of the safety that PHP doesn't have out of the box, and that's not mentioning any safety that would come from the language itself.

People say PHP is a framework, but as a framework it's terrible enough that you still need a framework for the framework.

Re: PHP 7.2.0 Released

#60
post #28

I use Hack now (I work for Facebook) and i kinda like it, at least in comparison to any untyped languages. So, serious question... Is there really any reason to use PHP over Have?

Hack is Great, I hope PHP will also introduce async/await, generics, JIT compiler soon.
Post reply on HN