Live data from Hacker News

A look at modern PHP

lwn.net

281–290 of 610 posts

Re: A look at modern PHP

#281
Can anybody comment on the state of Unicode in PHP?

I dimly remember that "proper" Unicode support was planned for PHP 6, and being one of the features that delayed that version, and contributed to it being skipped altogether.

Re: A look at modern PHP

#282

Earlier quoted context omitted.

PHP isn't being replaced by Rust or Go. It's being replaced by Medium, Wix, and Squarespace. At this point, the predominant reason it's still undergoing active development is that there is a metric ton of legacy PHP code. As the businesses still using it either mature, evolve, or fail, the need for PHP will begin to dry up. You're defending the language from an emotional standpoint. > choosing php for a new project i…

> PHP isn't being replaced by Rust or Go. It's being replaced by Medium, Wix, and Squarespace. Funny that you mention Squarespace as replacing PHP when they themselves are a big PHP shop.

The definitely are not a big PHP shop - they're a big Java shop, with maybe one small PHP acquisition.

This is evidenced in their open-source GitHub projects: https://github.com/squarespace

Re: A look at modern PHP

#283
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

"PHP only exists today because of legacies being maintained"

I think, the reason is, Facebook poured a load of money/time into PHP. Otherwise it would probably on life-support right now.

Re: A look at modern PHP

#284
post #283
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

"PHP only exists today because of legacies being maintained" I think, the reason is, Facebook poured a load of money/time into PHP. Otherwise it would probably on life-support right now.

FB poured a ton of money into Hack/HHVM. Which didn't directly benefit PHP. I do see that it inspired the PHP team to improve, but that's indirect.

Re: A look at modern PHP

#285

Earlier quoted context omitted.

Some people simply have reasonable standards. I tried for years to hire a PHP dev. I never found a single one. I found tons of people who had PHP on their resume, and not a single one of them was anything close to competent. PHP only makes hiring easy if you don't care about the quality of work that gets done. I can hire a million PHP monkeys, but everyone who has the right combination of intelligence and conscientio…

You can hire "good programmers" and ask them to write PHP - Facebook does

Facebook writes Hack, which is nontrivially different from PHP, and those differences matter.

Re: A look at modern PHP

#286

Earlier quoted context omitted.

One of the main benefits of PHP for web serving, is the "shared nothing" architecture. By operating as a non-threaded application, entire categories of bugs and security holes are avoided. Are there situations where threads could genuinely help? Sure, there is always an exception to any rule, but for the vast majority of projects where PHP is used, I don't believe threading would achieve much in terms of performance…

Yeah, but if you're worried about bugs and security holes, I'm not sure PHP can possibly help more than it hurts. E.g., type juggling: https://www.netsparker.com/blog/web-security/php-type-juggli...

There are very few places where PHP cannot do strict comparisons.

The first example in that article even highlights that `in_array` has a `$strict` parameter.

I'd bet a months salary it's easier to teach developers to use strict comparisons (either through arguments to be passed, or strict operators to be used) than it is to teach developers how to avoid thread-safety bugs.

Re: A look at modern PHP

#287
post #283
post #112

The amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world…

"PHP only exists today because of legacies being maintained" I think, the reason is, Facebook poured a load of money/time into PHP. Otherwise it would probably on life-support right now.

Facebook poured loads of money/time into HHVM. While I'm sure PHP also got benefits, your "Otherwise it would probably on life-support right now. " argument fits perfectly on the rest of the biased unsupported arguments.

Re: A look at modern PHP

#288

Earlier quoted context omitted.

Sure, but sometimes X is something like you have a video and you want to use the GPU to analyze it and the best library for that is in C and there are great python bindings. So a professional developer would use C or Python and not waste his client time by trying to create it's own unmaintainable CoolLang bindings (where this dev is just now learning CoolLang and there are not that many people that know CoolLang). Ev…

You can do this in Spring Boot/ Java, with one Java class and one config file. And it will likely be an order of magnitude more scalable & reliable than the PHP, having proper logging, security features, etc. Whereas such PHP systems in my experience tend to be unreliable, in need of maintenance and often broken. The Java/ Spring Boot option will also take you all the way to a high-end commercial system/ large websit…

You installed a framework Spring for a simple feature to grab some text from a POST request and dump it into a database. Since in general you don't have thousands of users sending feedback at the same time I don't need a framework and if you know how to correctly create SQL statements you don't need a framework for SQL. There is nothing to log, if the db call fails you can put some text in a log file or do a curl to a different url to notify you.

It will also be probably faster then a Java framework since you don't have a function call stack 30 levels deep (not a Java issue , all magic frameworks including PHP one have such giant call stacks)

Re: A look at modern PHP

#289
post #49

Earlier quoted context omitted.

The thing I hate about php is the inconsistency and unpredictability for new-to-php developers. camelCase? snake_case? nocase? Who knows what the global function will be. And who knows what order the arguments should go in. Sometimes the array is first, sometimes not (in array iterating functions like map). The thing that got my goat the most however was that referencing an undefined variable merely caused a warning,…

FYI when you start a PHP project you need to change your dev machine php.ini to be super strict, so all warrnings should just error out. The inconsistency seems to have it's logic and at that time was consistent and made sense, you need a good IDE to help with this. Using PHPStorm and then using PHPDoc to define your functions parameters and return type is a joy, the IDE will catch your type mistakes, show you where…

Thanks for the tips! I suspect PHPStorm/Doc may be the only one that flies for the legacy codebase I sometimes get involved with - turning warnings into errors would be suicidal...

Re: A look at modern PHP

#290

PHP, Python and Ruby all feel to me like last-generation languages. IMO we should be building new frameworks on modern languages that support concurrency & static typing. The most promising new stack I've seen is Kotlin's KTOR framework. Thanks to the expressiveness of Kotlin it's not really any more verbose than something like PHP or Ruby but it's far more powerful and robust.

I'm there with you about Kotlin. I started with PHP last "last generation" and was pretty bored with it. Kotlin was a breath of fresh air. Also, if you like some similar to Laravel/Symfony for Kotlin, give Alpas a try: https://alpas.dev/
Post reply on HN