Earlier quoted context omitted.
While I primarily program in python these days I have two major open source PHP projects (millions of downloads each). I was also part of the standards group that tried to modernize some aspects of PHP (to various degrees of success). In general I would never bring them up on this site. It's just not worth my time or effort. I've even gone so far as to ask people who have posted my blog posts here to take them down.…
> Hacker News has one of the worst groupthink cases in tech, where if you speak against various core beliefs you get absolutely hammered with trolls both on the site and off of it. Aside from PHP, can you think of any other topics that can be problematic in this regard? So far i haven't personally run into any that would get me disproportionate amounts of negative votes, however i find myself curious about it. The on…
PHP is worth learning and using
441–450 of 468 posts
Re: PHP is worth learning and using
#442Earlier quoted context omitted.
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…
> I don't think any JS code can be worse than old PHP code. I'm currently working for a company where all our microservices were written in Node.js by juniors. JS can absolutely be worse than PHP
Re: PHP is worth learning and using
#443I have used PHP for years. Like it. Have accomplished some nice things with it. Think it's evolved nicely in recent years. Feel it's a great tool for particular problems. Will continue to use it. Will always be open to alternatives. Will never understand why some people find that so offensive and will tell you that you mustn't use it or imply that you are ignorant or stupid for using it.
Here's a choose your own adventure for people new to the field. Pick something you want to build, then see which languages are the best suited. If you want to build several things, see which languages are the most recurring and versatile: - Web frontend: Javascript/TypeScript - Web backend: Javascript/TypeScript, Python - Performant backend (where you manage threads and queues): Go, Java, Rust - Machine learning: Pyt…
Re: PHP is worth learning and using
#444Earlier quoted context omitted.
My favorite thing about PHP is the execution model. Every single request is brand new and runs the whole program start to finish. IMO that's extremely powerful in its simplicity and while you can get it in other languages, it feels like like a "core competency" for PHP (just like how async code is easier in javascript than in python, because JS kind of had it from day 1)
Async code is a good way to achieve some level for performance in I/O bound workloads, but it's a pain for the programmer. Because of that I wouldn't say that it's necessarily a good thing that JS is async-first. In my opinion, high level languages should not expose async primitives to the programmer - this should be abstracted away by the language and its runtime. Go is doing this (all I/O is async under the hood),…
Just another reason why the "each request gets a process" architecture can work well. You generally don't need to worry about async stuff in PHP, because your request has the whole process to itself.
Re: PHP is worth learning and using
#445The closest this post gets to supporting its thesis is this section: > You might have heard people say that PHP was "doing serverless before serverless was a thing", and this is kind of true. I believe that PHP is...not bad I guess? I'm sure it can make good things. But after reading this I have no idea why I would pick up PHP over any of the other capable tools out there.
Why would you pick any other language instead of PHP for web dev?
*Python* A disgusting level of flexibility (probably too much). You never really get trapped into anything, you can even (but should not) overwrite functions during runtime. You can make and break all the rules. Supports a number of modalities (often badly). Really killer console-based debugging tools (I love pudb for instance).
*Elixir* Insanely durable data/process model that makes it incredibly difficult to damage a working path through a non-working one. Never have your entire web app crash again. Pattern-matching and message-passing based language makes expansion easy and low risk. Macros are best used carefully but when appropriate are a breath of fresh air.
All the languages are turning complete. By definition you can solve any problem with any of them.
Re: PHP is worth learning and using
#446Earlier quoted context omitted.
Async code is a good way to achieve some level for performance in I/O bound workloads, but it's a pain for the programmer. Because of that I wouldn't say that it's necessarily a good thing that JS is async-first. In my opinion, high level languages should not expose async primitives to the programmer - this should be abstracted away by the language and its runtime. Go is doing this (all I/O is async under the hood),…
Before being async as in async/await Javascript was also async as in having an external event loop and being event driven.
Re: PHP is worth learning and using
#447Earlier 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…
The value of a form input with the name “foo.bar” will instead be available under $_POST[“foo_bar”].
Re: PHP is worth learning and using
#448Earlier quoted context omitted.
Sure, but would you have that in production for the company you work for? One can also use old school CGI to serve their site, it’s super lightweight and you just upload the file at the right place, for almost any language. But that has been deprecated for the last 2 decades now.
Odd, I'm getting Perl/CGI gigs still. I should tell them to rewrite to...what's cool now?
It works for them, but I wont tell random people starting a business now to go with pen and paper, 99% of the time that would be a bad advice when there are much much better alternatives now.
Re: PHP is worth learning and using
#449Re: PHP is worth learning and using
#450Earlier quoted context omitted.
If you like PHP, great. Do you plan on creating a start-up that you intend to scale to a babillion customers? That you intend to hire teams of developers for? Probably not a good idea. Are you a new programmer trying to figure out which language to learn first? Absolutely not. Python, Java, JavaScript, C# are much more flexible if nothing else. Anybody who tries to convince new programmers to learn PHP is doing them…
> Do you plan on creating a start-up that you intend to scale to a babillion customers? Not interested in PHP in the slightest, but how is this myth still going around? Wikipedia, Pornhub, Facebook (initially at least) were all built on PHP. There are hundreds of other examples. Laravel nowadays has an outstanding reputation and I doubt it's performance is lagging so far behind Django for example. More generally, aft…
Maybe you haven't heard of startups failing because of choosing the wrong stack, but I'll wager you don't hear about most startups failing because...why would you? Also, have you heard of startups re-platforming? Either because the current stack is falling apart or the company is acquired by a bigger fish and they need to integrate with other services so parts end up getting rewritten to Java/C#.
The fact is PHP is good for making websites, and that's all you'd really want to do with it. There are other languages that are good at making websites and they are more popular and have other benefits.
If you are building things with PHP and it's working for you, then awesome. But seriously, why encourage it?