Live data from Hacker News

PHP 8

php.net

211–220 of 273 posts

Re: PHP 8

#211
post #194

Earlier quoted context omitted.

> - 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.

A world class VM tied to a dinosaur language in which you still have to escape regex metacharacters.

What are you talking about? Java has raw strings (autoescaping) https://openjdk.java.net/jeps/378 Moreover Kotlin allows to have a state of the art language in a state of the art vm

Re: PHP 8

#212
post #199

Earlier quoted context omitted.

You can get a much more powerful alternative for "free" if you support de-structuring assignments (in arguments). JavaScript Example: function test({a,b,c}) { console.log(c,b,a) }; test({ a: 1, b: 2, c: 3 }); If you have this there's really no need for named arguments anymore. If you add features to your de-structuring, your "named arguments" will have them too (things missing for JS specifically: optional objects, T…

It is not more powerful. You cannot do this for example: function hello($name='Joe',$title='dear') { echo "Hello $title $name"; } hello('Sue'); Try here: https://3v4l.org/6MZHh With your object properties approach, you always have to use the variable "names".

Mixing implicit positional and named parameters is a misfeature. The named parameters should have a distinct syntax like other systems do, e.g. :$ twigil.

Re: PHP 8

#213

Facebook’s backups were written in PHP. Well, the second version was, anyway. (The first version didn’t work so well.) By backups, I mean the central MySQL databases with profile and post information; not media or messages. The “Crown Jewels,” so to speak. It was written by an engineer in a week or so and then handed off to me. I was a storage guy with some programming chops. Fewer chops than I thought. Multiprocess,…

Can you elaborate a bit on what that code did? You said it a backup system talking to a MySQL? But there was a different front end and a different back end system that were both dependents on it?

Re: PHP 8

#215
post #37

Out of curiosity, why match expressions became popular for non functional languages? Without pattern matching on datatypes via cons expression (x::xs matching) it is just another kind of switch or if/else. Why do people promote this? here a nice comment on this topic: https://ocaml.org/learn/tutorials/data_types_and_matching.ht... "So one Really Cool Feature of functional languages is the ability to break apart data…

One reason for PHP specifically is that in PHP switch performs type coercion whereas match does not.

Re: PHP 8

#216

Facebook’s backups were written in PHP. Well, the second version was, anyway. (The first version didn’t work so well.) By backups, I mean the central MySQL databases with profile and post information; not media or messages. The “Crown Jewels,” so to speak. It was written by an engineer in a week or so and then handed off to me. I was a storage guy with some programming chops. Fewer chops than I thought. Multiprocess,…

I'm confused by your use of the term "backups" do you mean backend?

Re: PHP 8

#217

Earlier quoted context omitted.

Laravel is good and bad for the ecosystem at the same time. I've interviewed a lot of people lately who know laravel but not php. Similarly to people who claim they know react but fail in the most basic js questions.

Additionally Laravel abuses patterns like singletons and in general static methods. This is really a no-no for modern PHP, in my opinion. I think Symfony had a way better impact on the ecosystem.

To be fair, Laravel’s facades look like static method calls, but they’re actually not. They’re backed by the service container and can be swapped out for mocks etc just as easily as injected dependencies. They’re also totally optional, and in general are falling out of fashion within the community.

Re: PHP 8

#218
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-...

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.

Re: PHP 8

#219
post #216

Facebook’s backups were written in PHP. Well, the second version was, anyway. (The first version didn’t work so well.) By backups, I mean the central MySQL databases with profile and post information; not media or messages. The “Crown Jewels,” so to speak. It was written by an engineer in a week or so and then handed off to me. I was a storage guy with some programming chops. Fewer chops than I thought. Multiprocess,…

I'm confused by your use of the term "backups" do you mean backend?

I think they literally mean backups of critical data, managed by PHP code.

Re: PHP 8

#220
post #183

I got spoiled by PHP as my first language. It was so easy to get going. I was surprised to learn that other languages didn't work the same way, when integrating into a web server. Also it has always been rock solid. A bug in my code brought down only that request for that user, totally did not affect or even slow down responses to other users. People have attacked its syntax forever. I avoided the worst of it by lear…

you are doing it right. if you want to use fancy jargon for what you're doing say "I use apache as the controller, the database as the model and php for the view". that's how it's supposed to work since the first version of php/fi. php is primarily a templating engine. but I disagree concerning register globals. I think it was the single thing that made php the most accessible language. we should bring them back but…

[deleted]
Post reply on HN