Live data from Hacker News

PHP in 2023

stitcher.io

151–160 of 285 posts

Re: PHP in 2023

#151
What are authoritative documentation sources for php these days? For javascript and browser apis, that would probably be mdn.io, and possibly web.dev. Any equivalents for php? php.net/manual looks like it might be it; but it contains numerous comments from years if not decades ago.

Re: PHP in 2023

#152

Earlier quoted context omitted.

I'm on PHP 8 and I feel the same as parent. Sure, there's been a lot of progress since the PHP 5 days, but the core of the language has been left mostly untouched by design, and we haven't seen the kind of drastic moves like JS moving to ES6 syntax. It's a matter of taste, so there's no absolutr truth. I hate PHP's function and property access syntax differenciation and wildly prefer ruby's approach or instance. And…

Uhm, how about PHP attributes, getting rid of comments / annotations? Named arguments? Constructor property promotion? Readonly properties (8.1) / classes (8.2)? Arrow functions or typed properties (both 7.4)? I'd say those are really cool things. Especially as a web developer, there's just so much boilerplate I can get rid of since using 8.0+.

I’m in agreement with you that it came a very long way.

Now, most of those have been present in many other languages [0], often with less limitations.

And as usual the old ways haven’t all been deprecated either, so it stays weird. For instance typed properties were a chance to reset the clock on type handling, but no, declaring a type will force cast parameters to that type instead of throwing an error (i.e. passing 0 for a string argument will convert it silently)

[0] Constructor property promotion isn’t, but TBH I’m of mixed feelings about it. We get conciseness in exchange for weirdness as the properties aren’t declared outside of the constructor, where they would be otherwise. I wished it was done the other way round.

Re: PHP in 2023

#153
post #49

Earlier quoted context omitted.

It’s funny because when I think of “fractal of bad design”, Javascript is the first thing that comes to mind. I love Javascript but it makes me ask “why?” a lot.

Php's inconsistencies in regards to needle vs haystack make me weep. Javascript doesn't have anything remotely like that.

I hope you realize that "fixing" these types of early mistakes is almost impossible for PHP, a language which tries hard not to break things, especially something that's going to be used everywhere. But if this is such a deal-breaker and your IDE is dumb as a stump and can't remind you nothing prevents you from wrapping the stdlib or using something like psl to do it for you.

Re: PHP in 2023

#154
post #105

Earlier quoted context omitted.

I'm on PHP 8 and I feel the same as parent. Sure, there's been a lot of progress since the PHP 5 days, but the core of the language has been left mostly untouched by design, and we haven't seen the kind of drastic moves like JS moving to ES6 syntax. It's a matter of taste, so there's no absolutr truth. I hate PHP's function and property access syntax differenciation and wildly prefer ruby's approach or instance. And…

Maybe PHP can add a "stricter" mode that gets rid of all the cruft? Enable it per-file, allow it to simmer for 10 years, remove legacy support in PHP 12.

This would really help in a lot of way IMHO. PHP has good aspects, getting rid of the weirder one, even if compatibility gets sacrificed, would be a boon for building new applications.

Re: PHP in 2023

#155
I learned programming with PHP back in the mid-2000s, and worked professionally with it until about two years ago. I haven't touched it since 7.4 or so, except to help some friends with WordPress sites and such.

It might be me getting old and grumpy, but PHP seemed to peak in terms of usability and syntax around 7.2. Lots of the new type syntax in the article is... inscrutable to me. I'm all for strong typing in general, and I don't miss the type coercion and weirdness of PHP, and I'm glad to see it continue to move forward. It's just the syntax.

Back when PHP 7 was being discussed, I followed the arguments on the mailing lists closely and was rooting so hard for those advocating adding much more explicit and strict typing, and I remember me and a coworker getting rather upset at the old timers like Zeev who were adamantly opposed (and who mostly lost the fight). I'm only 33, but I've got nearly 20 years history with PHP, and I suppose now I'm the old timer.

My last project in PHP was forced by business concerns to support PHP 5.4 through (at the time I left) 7.4. The massive pain required to make that work might have colored my perceptions of the whole situation.

Re: PHP in 2023

#156

Earlier quoted context omitted.

Small PHP community, now I've heard everything.

It feels large to you because you are in it. Other language communities feel small to you because you are not in them.

PHP is far from my primary language, but in no universe is the language that powers so so much of the internet "small".

Re: PHP in 2023

#157

I started my career with PHP. Created my own apps, created client websites etc. Full of footguns, but I didn't know any better. Once I learned more languages, I never used PHP again. I actually started to feel like I'd been fooled into using PHP. Now the small PHP community keeps trying to justify their language choice with articles like these and comments like the ones on this submission. They claim it's a no braine…

I don't wish to be the bearer of bad news, but nobody is trying to convince you to use it: nobody cares what you're using for software development... and you're working with out of date information if you think that A Fractal of Bad Design is relevant any more. PHP has evolved a great deal over the last decade, as have the people using it and as has the ecosystem.

Personally, as my username might hint, I've been using PHP for a long time, and, as I've commented on HN before, I would not choose PHP if I was building an engineering organisation from the ground up, and I do not use PHP professionally at the moment, but I absolutely choose to use PHP for my own projects and can enthusiastically say it's a great language in 2023.

If you're not willing to try out modern PHP, that's fine, but ranting and raving about PHP based on your experience more than a decade ago is not relevant any more, given this is a post about the improvements made in the last decade. Many people with experience beyond PHP think PHP is a great language today.

Re: PHP in 2023

#158

I started my career with PHP. Created my own apps, created client websites etc. Full of footguns, but I didn't know any better. Once I learned more languages, I never used PHP again. I actually started to feel like I'd been fooled into using PHP. Now the small PHP community keeps trying to justify their language choice with articles like these and comments like the ones on this submission. They claim it's a no braine…

Out of curiosity, what language are you using for backend now? Not a fan of PHP like most of professional PHP devs, I guess but the utility of Laravel for example is unbeatable IMO.

Re: PHP in 2023

#159

If you are thinking about building a web application, take a look at Laravel. I not a huge PHP user, but Laravel is always on the top of my list for building web applications. It's the greatest web framework to ever exists, even better than Rails IMHO. The ecosystem around Laravel is really incredible and unlike any other framework. They have libraries for every stage of a web application from taking payments all the…

Laravel is great if you just want to get something simple done as fast as possible with the simplest, most elegant (at a glance) code possible and don't care at all about understanding how it works, what's going on under the hood, performance, doing anything the devs didn't expect, etc.

Everything in Laravel is as obscured, "magical" and opinionated as possible for the sake of making the code "beautiful" (again, at a glance) to the detriment of basically everything else. I really have no idea how any experienced programmer can look at it and think it's usable for anything beyond the most simple project.

The mere fact that models are PHP classes but none of their properties that exist in the database are actually declared as properties in the class because the ORM just "magically" puts them there at runtime should be enough to drive away any sane person. And let's not forget the amazing "Facades" a.k.a. glorified global variables filled with magic methods that you're expected to make extensive use of.

Re: PHP in 2023

#160

What are authoritative documentation sources for php these days? For javascript and browser apis, that would probably be mdn.io, and possibly web.dev. Any equivalents for php? php.net/manual looks like it might be it; but it contains numerous comments from years if not decades ago.

The English version of php.net/manual is the authoritative source. It covers all the features found in the latest version. Just because it contains comments from decades ago doesn't mean that the content itself hasn't been updated for decades.
Post reply on HN