Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

341–350 of 468 posts

Re: PHP is worth learning and using

#342
post #61

Earlier quoted context omitted.

For people of a certain age and job history, the worst code they've ever inherited was written in PHP. I think JS can be worse. There are things that are possible with dynamic languages that are literally impossible with static ones. So think of PHP less as a "bad language" and more of a code smell.

I don't think any JS code can be worse than old PHP code. I've had to deal with legacy software written with PHP4. I was to port it to PHP7 since it was not compatible with PHP5.4+. The code used "register globals", meaning that variables were created on the fly from the parameters in the URL, the POST form data, and the cookies. Requesting `index.php?something=X` implied `$something = "X";` in the global scope at th…

Don't forget how is built-in and was heavily abused to create insecure, incomprehensible spaghetti messes.

You'd have to try really hard to make callback labyrinths in JS match the mess that came out of the above combined with runtime-as-template-engine. This was basically idiomatic at the time.

Re: PHP is worth learning and using

#344
post #98

Earlier quoted context omitted.

Except Facebook literally did that :) But I agree with you.

Yep, almost 20 years ago and it's been both a technical and hiring problem for them ever since.

Is there any large tech company without technical and hiring problems?

Re: PHP is worth learning and using

#346

Earlier quoted context omitted.

I don't find this to be true at all. > you need an external server Spoiler, you need an external server for everything on the web; you've just been brainwashed to think serverless is actually that.

You do not need an _external_ server for a lot of languages. If you use node for example you can use the express package to run a custom server, or embedded tomcat for java

PHP has a built in web server you can launch from the CLI and run the script. `php -S `

Re: PHP is worth learning and using

#347
post #336

I'll be honest. I really don't like PHP. However when I was running a coding workshop, very frequently people would ask: "How do I make a web page talk to a database?" I'd say: Well, you know that HTML file? Rename it to become a PHP file and you're almost there! As pretty much all cheap hosting already offers support for PHP (and MySQL for that matter) this would almost always work. I would love to be able to do thi…

It's still far behind PHP[0], but with Next.js/blitz.js I think we're going in the right direction.

[0]: as in, I would have nightmares trying to introduce beginners to full JS stack vs I would have nightmares thinking what they will end up coding when they easily become dangerous with PHP (which is I guess why there are so many bad PHP codebases: it's super easy to start)

Re: PHP is worth learning and using

#348
post #60

Earlier quoted context omitted.

Sure, a small minority of sites are partially written in python.

Tons of sites are written exclusively in Python. Django alone has 60k stars and 25k forks on Github. That about the same as Laravel.

A quick search came up with an order of magnitude more sites in laravel than django. And combined are still a small fraction of sites on the internet.

Re: PHP is worth learning and using

#349

Earlier quoted context omitted.

I have seen people deploy php this way but I'm not aware of anyone who'd do it today. Locally however it is save, alt-tab, ctrl-r and immediately you see the result. Absolutely no waiting. These days I rather use Quarkus for this but until Quarkus arrived this was a huge advantage that PHP had over every other language and framework I was aware of. Also the documentation was fantastic compared to most of the stuff I…

I deploy with a git pull Which I suppose is just a fancy way of a copying files to the server.

Same. Our Node applications can take up to 10 minutes to build and deploy from a pipeline, but our PHP applications are deployed in <2 seconds by executing `git pull` on a VM.
Post reply on HN