Live data from Hacker News

A look at modern PHP

lwn.net

361–370 of 610 posts

Re: A look at modern PHP

#361
post #289

Earlier quoted context omitted.

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

You don't turn warnings into error on production but it will help to have them enabled on your local machine, otherwise errors are ignored and you would waste your time debugging weird issues. You can do this per file too using the "ini_set" https://www.php.net/manual/en/function.ini-set.php

Re: A look at modern PHP

#362

Earlier quoted context omitted.

Ya? Can't speak for others but I've worked on many legacy C++ codebases over the years, it has never been a pleasant experience. Even when it's a C++ 17 codebase the same bad practices from C++ 11 and earlier are all present and accounted for. As are the subtle bugs stemming from an inconsistent standard library and C++'s approach to verbose error handling. I'm sure that there's plenty of good C++ code out there, may…

> I can literally copy and paste what you said replacing it with any language and end up being correct. This is the best point in this thread, IMHO. I think it also is due to the fact that PHP is a fairly easy language for a non-coder to pick up little-by-little. One can easily start using it for doing simple things, like injecting dynamic data into a web page. From there one can learn to scale up to full web apps. I…

Onramp is gentle... to a point. While I'm a fan of PHP for what it is, there are still plenty of footguns. Probably more than modern statically typed languages.

Re: A look at modern PHP

#363
post #341

Earlier quoted context omitted.

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…

I'd use whatever lightweight and secure I can find at a moment. Simple file upload without any future expansion plan doesn't need hours of discussion.

It depends on the customer, will they give you a server dedicated for your Java framework so you can handle at maximum 5 POST request per day or will day give you access to the existing website they have for the company, that already has PHP,mysql installed. Honestly you are not doing the fair thing for the customer if you ask for a new server because you want to use your prefered tool and not the best thing for this job.

Btw my scenario was about sending feedback ro stack traces, this are just text, no giant file uploads and nothing insecure about it.

Re: A look at modern PHP

#364

I wonder if most developers that trash on PHP for trivial issues like seen in this thread haven't been using it for many years, or had a bad experience (e.g. maintaining a legacy app). Some developers live in a kind of technical vacuum where, I guess they assume, the technical features of their programming language are what makes the difference in the value of the business they're building. In reality, the difference…

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…

Are you trying to hire vanilla PHP devs or framework PHP devs?

In my previous company (based in Paris, FR) we had a very hard time getting skillful PHP devs, even if there were a lot of candidates.

Re: A look at modern PHP

#365
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…

I do not do PHP and only have done a bit a long time ago, but I chuckle at the statement that nobody starts any project in PHP, only to find that a huge amount of new sites are wordpress sites, and they are a gateway to PHP. And do not discard WordPress, because it is amazing in how you can have a productive web site with no programing knowledge. After your site actually generates value then you can hire programmers…

This was said of Cobol not too long ago. Today's enthusiasts decide tomorrow's workhorses.

Re: A look at modern PHP

#366

Earlier quoted context omitted.

I think you're missing a third group of PHP haters that's actually a majority: those who've used PHP, sometimes extensively, and built up a backlog of "this is stupid" bits in their head about it. They don't have deeply reflective reasons or a strong theoretical basis for hating it, they've just suffered with it for a good while, found some better alternative, and are now sceptical that any amount of improvement will…

That's a really good point. Nothing is perfect, and frameworks are no different, so after awhile the friction points come to the fore. Also, I have a theory that with the more common languages, you obviously find a much broader user base of beginner-level programmers, or, worse, programmers who just don't care about quality, which translates to more dysfunctional code in the community in general. My coworker at one c…

It would be interesting to see a ranking of programming languages by the rate at which they accrue ill-will with continued use :)

It's a very good point: the more widespread a language, the larger the proportion of users will be beginners, who will almost certainly confuse their own inexperience with language-driven frustration (again, c.f. JavaScript). My pet theory on the broad appeal of PHP is that it coincided with the easy availability of shared hosting accounts where PHP was the default scripting environment available. The barrier to entry for blogs, shopping carts, forums, everything was incredibly low, leading to an explosion of software, tutorials, walkthroughs, and community that was heavily slanted towards beginners, dilettants and "low end" programmers". I made a living as one for several years, doing PHP for $5-10k jobs, and there was endless small-business work in this segment.

If modpython had worked as well as modphp, the world might look very different today.

Re: A look at modern PHP

#367

Earlier quoted context omitted.

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

Many employers use php because it allows keeping salaries down, though. So your advice would not work for those.

The parent post complained about the quality not salary level of PHP programmers, though. The parent wants a quality PHP programmer, you want to keep salaries down - there is an acceptable tradeoff, somewhere.

Re: A look at modern PHP

#368
post #346

Earlier quoted context omitted.

In fairness the wheel has turned and node developers are seen as not respected. If you haven't moved to go/rust/serverless by 2018 the cool market has moved. When I got started in 2000, php developers weren't as smart as perl developers. Then it was asp. No serious business would use php over asp. Java developers always had this attutiude but they were always treated as second class from c++ developers who were treat…

As a fun, tongue-in-cheek project, someone should build a website with this timeline of languages going from cool to uncool. For people who are busy with life and work, but who want to learn a new cool language, it would answer the question "what's the cool thing right now?". You look at the timeline, it's language X. This also enables fun future oniony articles like "Go no longer cool", "Rust going the way of the di…

You forgot the "X is considered harmful" article.

Re: A look at modern PHP

#370
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…

Here's some interesting facts about PHP I like to know and share. How many of them are now untrue?

"foo" == TRUE, and "foo" == 0, but TRUE != 0

NULL PHP sez:

    Parse error: syntax error, unexpected (T_PAAMAYIM_NEKUDOTAYIM)
Post reply on HN