Live data from Hacker News

PHP in 2019

stitcher.io

231–240 of 489 posts

Re: PHP in 2019

#231
I think the way to analyze a language and framework should be: "what does this framework permit the worst developer on the team to do?"

I think the story for Php in this regard has not been a good one historically.

You can put processes like PR review, and add coding standards, but getting things done will always trump those things, especially when you are bootstrapping.

If you can tell me modern PHP is better than the alternatives at preventing bad behavior (or encouraging good behavior) then I'm interested. But, this post didn't move me to change my mind there.

Re: PHP in 2019

#232
post #146

Earlier quoted context omitted.

Nice! It looks very nice and complete. I've found this other one in Go lang https://buildsaasappingo.com (I'm not affiliated nor tested it) I think it is a good idea to turn something that you need for yourself into a side income, I've though about doing this same thing myself in a different language. What can you tell about your experience building this course, is it worth it ? rewarding ? Did you find difficult to…

That's how the course came into existence. I built a number of SAAS apps (and apps that had similar functionality) for a few freelance clients. Then I eventually thought "hmm, lots of repeated patterns here, maybe I can make this into a course", so then I made the course. As for the process. Funny you mention it. The changelog just had me on as a guest for their "backstage" podcast last week where we talked about con…

wow, serendipity I guess :)

Definitively I'll check the podcast, thanks a lot!

Re: PHP in 2019

#233
Yeam im really digging php these days. Composer and Laravel have made it fuggin awesome! I think more so the frameworks built when php was first picking up steam are a little convoluted and oldschool (im looking at you drupal!... 6 & 7, mostly). The language has come along way since then though, so thanks to the team for all their hard work.

Re: PHP in 2019

#234

Earlier quoted context omitted.

> ven assuming that "modern" PHP managed to come up with better ways to deal with all of this, I assume that these obsolete functions and operators still linger for backward compatibility? If so how do you avoid them? I think the "path of least resistance" is important: developers are time-constrained, understanding-constrained, lazy (if they're virtuous), etc. There's a big incentive to do whatever is easiest/quicke…

You can't remove those old APIs without changing culture, and culture is really hard to change. One thing that shocked me during my brief foray into PHP was how heavily popular PHP apps like WordPress rely on the filesystem. Want to move a site? Copy the database, and copy a bunch of files . It seems like there's a cultural expectation that applications run on a single server in your closet. Of course you don't have…

Why was it shocking? PHP (originally) stood for "Personal Home Page" after all...

Re: PHP in 2019

#235
post #223

I always wondered, in a world where 1. people seem to hate writing (old?) PHP, and 2. there are a good dozen languages that were created solely because people hate this other language Javascript , which both compile to Javascript and have the semantics of Javascript, just not the syntax or stdlib of Javascript; ...why we didn’t end up with languages compiling to PHP, targeting the Zend VM, or whatever you’d have to d…

Because Javascript is the only thing that runs on the client side.

Re: PHP in 2019

#237
The sad thing is that nothing else has come along to fill the niche that PHP fills. Here are the key advantages of a PHP like language:

1. Low barrier to entry. An HTML document is pretty much a valid PHP program. You can add as much or as little code execution as you want to it. While at a certain point you should probably use templating (to handle things like escaping automatically, etc) but a low barrier to entry really helps get people on.

2. PHP has a stateless functional core. All the system functions are part of the web server binary. There's no loading some giant object tree just to print something to the screen. This is huge because of...

3. Resource management for serving HTTP requests is, to me, basically ideal in that you create a bunch of stuff, spit out a result and then tear everything down. It's hard to leak resources this way. No garbage collection oddities to deal with. The Java equivalent to this was the servlets API (years ago) but it doesn't share the same issues;

4. No multithreading on a per-request basis so you don't have to deal with race conditions at all in user code;

5. An opcode cache sufficiently closes the gap on code performance in the vast majority of cases at little to no cost to the end developer; and

6. Typically you can just hit reload on your browser and immediately find out if something works. That's really nice.

Big things missing from PHP:

1. A good type system. I use Hack at work (Facebook) and this solves a lot of problems; and

2. Cooperative multitasking via async/await semantics (again, Hack has this).

I'm a big fan of PHP not making breaking changes (badly) like Python did. You can't fix the inconsistent argument ordering in standard functions ("is it needle, haystack or haystack, needle?") but it basically doesn't matter at this point. I use an IDE that tells me the correct order anyway so who really cares? The way to handle that is to create new versions that are consistent.

Hack has these collections: vec, keyset and dict. These essentially replace array (side note: PHP maintaining insertion order on array is such a hugely useful feature). They have a consistent set of library functions (in C\, Vec\, Keyset\ and Dict\).

One other thing that I found hugely useful when I first did PHP was preg_replace_callback. I found this so useful that when I did Java after that I basically write a version of this function.

So anyway, there are a ton of legacy problems with PHP but nothing else has that same set of desirable characteristics IMHO and I really wonder why not.

Re: PHP in 2019

#238

And yet ~everything in https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ is still true. All that's happened is that the language is even more complex, has even more baggage.

You could make a similar article about Ruby, Python, or Node.js. None of these are bad languages, but you can't write a perfect language, because languages are designed to be used day in and day out by people. I like Python and I've found that some of the things I really like about Python are the same things other people dislike about it.

PHP has a lot to like about it - otherwise it wouldn't be as popular as it is.

Re: PHP in 2019

#239
post #97

Earlier quoted context omitted.

No, it's not. PHP has disabled or removed the major anti-features like magic quotes, globals, URL includes and the bad mysql extension. It has a proper AST-compatible parser which removed tons of quirks, and added syntax sugar to look more normal to outsiders. The remaining things are: • the endless whine about inconsistent underscores in function names and haystack/needle. These are a bad look, but aren't really an…

> (PHP devs memorize the common functions.. Nope (c) Me, after 5 years on trying to but still falling back to googling every 20 minutes despite years and years of using the language. ... And just writing code without looking into docs much after a week with ruby

An auto-completing editor is a big help when using PHP. :)

Re: PHP in 2019

#240
post #51

As far as I'm concerned the bridges have burned a long time ago and I definitely can't see myself giving PHP a second chance. That being said, if I'm wrong and PHP has really managed to become a decent language (or at least something that's not completely insane) its defenders should focus on actually showing what modern PHP code looks like. Is performance that much of a big deal for most people? In a world where Rub…

It's gotta be the easiest stateless system to get started with, right? It's decidedly not a BAD language anymore. It probably has some of the best tooling for said system as well. And it has a GIGANTIC community.

That's worth a lot to most people, I think?

Post reply on HN