We shit on PHP and JavaScript all the time, but are they really that bad? Over half of WWW is powered by them, they got to have some redeeming qualities.
>>108421937A typical php project is better than the abomination that is a typical js + react project
>>108421937PHP is popular because twenty years ago it had an extremely low barrier to entry. You can turn a static HTML page into a dynamic PHP page by sprinkling in a few tags and then put it on cheap shared hosting.Other languages tend to require more upfront boilerplate and more expensive hosting because they weren't specifically designed for that use case.In most other ways the language was awful. Modern PHP is much better but still kind of bad. There's no reason to use it for serious projects besides inertia.In theory PHP's language design has a kind of interesting niche as a half-dynamic language. In practice it ends up with the worst of both worlds and is full of unforced errors that can't be addressed without breaking backward compatibility. It also throws together a lot of paradigms without trying to unify them. Some parts feel like Perl, some like C, some like Java. (The Java-like features are tedious but relatively sane and should be leaned into for serious long-term projects.)PHP isn't dead but it's not in great health. Tooling like autoformatting and typechecking is far behind JS and Python. JavaScript is popular because it's the one language you can natively run on webpages. It has blunders but not nearly as many as PHP, it's more cohesive than PHP, and it gets massive investment from browser developers and its own community.Closures and object literals are charming primitives. JS is not my favorite language but I understand why someone might prefer it even if they know other languages well.TypeScript is perversely good at retrofitting existing code, it's genuinely impressive technology.
php has copy-on-writeboth have proper "function" keyword