Live data from Hacker News

PHP 8

php.net

221–230 of 273 posts

Re: PHP 8

#221
post #4

Apparently some of the deprecations will make this the most backward compatibility breaking version jump of PHP since V4 to V5. (Read a german interview here: https://www.heise.de/news/PHP-8-im-Experten-Check-Der-erwart... ) There's a long report on Wordpress and PHP 8 and it's not pretty: https://developer.yoast.com/blog/the-2020-wordpress-and-php-...

Wordpress is a bit special case though as it has tons of very old code and a lot of plugins, some of which aren't maintained anymore.

Re: PHP 8

#222
post #218

Earlier quoted context omitted.

Just tried it on a Laravel project I'm working on, on Windows. Worked flawlessly. On the downside, no noticeable performance improvements. Report generation times: PHP 7.4 = 67ms avg PHP 8.0 = 66ms avg This is getting the data from MySQL and massaging it for the templates. With Laravel's insane amount of indirection, of course.

Why would you expect performace improvements? Because of JIT? There's no reason to hope that JIT would help with that much, because it's I/O-bound anyways. And function calls in PHP are pretty efficient.

PHP 8 performance improvements were advertised

https://www.fonow.com/Images/2020/0608/9f3a0f6a4f8f2ee.png

https://www.fonow.com/Images/2020/0608/4e9d2337edd2072.png

https://www.fonow.com/Images/2020/0608/70a1c6cff23f4fc.png

Re: PHP 8

#223
post #83

Earlier quoted context omitted.

> I was surprised to learn that other languages didn't work the same way, when integrating into a web server Oh boy... I'm still not sure how you deploy a non-PHP webserver to be honest... every language seems to be doing something different, with php you just needed to drag & drop your files in the "public" folder.

> I'm still not sure how you deploy a non-PHP webserver to be honest... every language seems to be doing something different Coming from PHP and having used a bunch of different languages I can understand what you are saying. Unlike PHP, the other languages run in a process that listens on a port (80, 443 or another). The single process continuously run and handles multiple requests. Back then, I still had to use NGI…

Caddy largely solves that problem. A config for a PHP app is usually about 4 lines long, see the example on this page: https://caddyserver.com/docs/caddyfile

Re: PHP 8

#224

Where's the best place to suggest a new feature or improvement for PHP? I've always wanted to see `foreach` get a built-in iterator/counter so you don't have to create and use a counter variable manually. Current way: $i=0; foreach ($array as $key => $value) { echo "Loop $i of " . count($array); $i++; } Possible new way: foreach ($array as $key => $value, $i) { echo "Loop $i of " . count($array); }

While not quite as ergonomic as your example, it's rather trivial to extend ArrayIterator to accomplish your goal:

    foreach ($iter = new IndexingIterator($array) as $k => $v) {
        echo $iter->index();
    }

Re: PHP 8

#225
post #33

React php is worth checking out. Async stuff like websockets and non blocking redis subscriptions.

What is React PHP?

Think of it like if PHP had Node's event loop runtime.

There's also Swoole, which is like if PHP had Golang's runtime (i.e. coroutines and such).

Re: PHP 8

#226
post #209

React php is worth checking out. Async stuff like websockets and non blocking redis subscriptions.

ReactPHP and all the other "async" frameworks became obsolete the moment Swoole entered the game.

Big disagree. They're just different. Swoole is like Golang, ReactPHP is like Node, in terms of runtime style.

Re: PHP 8

#227

Earlier quoted context omitted.

> And so people who ... wish PHP was a different language are the ones influencing language development. That's definitely been my impression. I used to be a professional PHP developer, still use it occasionally for personal projects, and appreciate the language, warts and all, even if I can't truly say I love* it -- but I'm only half-joking when I quip that PHP has evolved from its roots as a cargo cult version of P…

> - but I'm only half-joking when I quip that PHP has evolved from its roots as a cargo cult version of Perl into a cargo cult version of Java. It's a joke in so far as it is funny - but it's absolutely correct. When you only look at the language... When looking at the VM, Java has an absolutely world class VM, with great engineering and decades worth of research poured into it. PHP has... no such thing.

PHP has an initial implementation on GraalVM

That is completely ignored by the community

Re: PHP 8

#228
post #87

How should one start learning with PHP these days? My experience: hacked together a few PHP scripts over the years to notify me of a website change (5 minute cron job). Before that, I was a very good beginner with VB6 back in highschool. There are a couple of ambitious database-driven website projects I would like to create, but I don't know where to start. I like the KISS philosophy, and I think PHP and MySQL would…

>w3schools PHP tutorial I think a better approach is to think of a (very basic) project you want to create, and then claw and bite your way through it, until you have something that works. Then think of a way to enhance it, and go though the process again. Slogging through a tutorial is boring, and you have nothing to show for it when you're done. PS: Don't listen to sneaky JavaScript evangelists. Wicked! Tricksy! Fa…

Agreed, that's how I learned. Also run it by someone that knows PHP so they can yell at you. I've used prepared statements ever since then

Re: PHP 8

#229
post #218

Earlier quoted context omitted.

Why would you expect performace improvements? Because of JIT? There's no reason to hope that JIT would help with that much, because it's I/O-bound anyways. And function calls in PHP are pretty efficient.

PHP 8 performance improvements were advertised https://www.fonow.com/Images/2020/0608/9f3a0f6a4f8f2ee.png https://www.fonow.com/Images/2020/0608/4e9d2337edd2072.png https://www.fonow.com/Images/2020/0608/70a1c6cff23f4fc.png

Oh, come on. Did you see the benchmarks? This is CPU-bound code, like multiplying numbers 100 000 times over. This has nothing to do with your typical use case.

And, yeah, performance improvements are always advertised.

Re: PHP 8

#230
post #7
post #4

Apparently some of the deprecations will make this the most backward compatibility breaking version jump of PHP since V4 to V5. (Read a german interview here: https://www.heise.de/news/PHP-8-im-Experten-Check-Der-erwart... ) There's a long report on Wordpress and PHP 8 and it's not pretty: https://developer.yoast.com/blog/the-2020-wordpress-and-php-...

"There's a long report on Wordpress and PHP 8 and it's not pretty" I wonder if that's somewhat on purpose. Part of the remaining stigma with PHP is that people cite bad PHP examples from WP.

As a PHP dev this is a really fair comment.

I think the other reason non PHP devs think we are in the dark ages is because when they google it, our documentation looks like it's from 2010. It's a bit of a joke really.

Post reply on HN