Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

51–60 of 468 posts

Re: PHP is worth learning and using

#51

I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that area. If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities, I don't really understand the benefit. PHP is often used to do certain things or it may be faster for you to whip something up in Larav…

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 a great disservice.

Re: PHP is worth learning and using

#52

I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that area. If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities, I don't really understand the benefit. PHP is often used to do certain things or it may be faster for you to whip something up in Larav…

How is PHP 8.1 an “older car”? Have you looked at the language and runtime recently? I hear stuff like this from people whose latest PHP knowledge is based on that ancient fractal of bad design article.

Re: PHP is worth learning and using

#53
post #7

This seems like a false dichotomy. Is php totally worthless in 2021. Absolutely not. Is php the best language to spend your limited time learning in 2021? Almost definitely absolutely not as well.

But, what is, if not php? Do you shoot for what has had longevity, or what's rising?

Python, JavaScript, Java, C# have all had great longevity, and much more popular, and can do anything that you can do w/ PHP and a whole lot more. Encouraging new programmers to learn PHP is cruel.

Re: PHP is worth learning and using

#54

I don't really understand the reasons for using PHP outside of that people are already familiar with it and like working with it or want to find jobs in that area. If someone is new to software development and in an area of the world where it's not mostly PHP shops, so bigger cities, I don't really understand the benefit. PHP is often used to do certain things or it may be faster for you to whip something up in Larav…

I think there's value in a large, established ecosystem.

Languages tend to go through a few years of flavour-of-the-week fads (think of the Vue/React/Angular competition, and all the also-rans that we can't remember now). If you get in too early, there's a fair chance you'll bet on the wrong ecosystem, and end up with unsupported dependencies or difficult to maintain code. In the worst case, you scrap the whole thing in six months and write it for a new framework to keep it alive.

PHP went through that phase back when "we've got to support IE6 users" was a legitimate talking point. You can be reasonably confident Wordpress or Laravel are here to stay.

PHP is also fundamentally a hugely battle-tested platform. It's been ran on 486s in the broom closet, and entire rack clusters in data centres. If you have some performance or usability problem, there's a good chance someone else has had it already and worked out a solution. With some new language, your odds of "never seen that before" errors are much higher.

Re: PHP is worth learning and using

#55

Folks bashing PHP like it's crap but praising any crappy thing if it's built with an esoteric lisp-based language. I mean, if you're starting out, chances are you're better off with js/py or even go but in the end you're paid for the types of problems you solve, not by the language you use... It just turns out that some problems are easier in this or that language, or even people who are good at solving this or that…

The thing people forget about most is the LAMP stack. Although before node.js, PHP was simply a viable cost saving language to use. Now that WordPress moved to node however, it doesn't seem worthwhile to learn unless there are special uses you can get out of it.

But I agree with you about the whole "esoteric lisp-based language" comment. It seems like every other day I see something like that here and all I wanna say is "why?" I mean nobody cares about lisp except for the stallman-esque nerds. The best programming language is the cheapest one to create, support, and replace others with. Not cause some random programmer that thinks they know what they're talking about because they don't like it.

Re: PHP is worth learning and using

#56
post #47

I have a few questions: - Is the "your app gets initialized and torn down for every request" true for frameworks like Laravel and Symfony? - Does this model uses OS threads? Does it uses green threads? And then a few remarks about the language: - I feel like the Go model is a way better model for server software than async. Since PHP is mostly used for server software, I feel like they shouldn't go with async. Python…

> Is the "your app gets initialized and torn down for every request" true for frameworks like Laravel and Symfony?

Yes, though heavy optimization in opcode caching and JIT keeps it fast and the primary process manager today (php-fpm) generally keeps a pool of PHP processes persistent. Each request is initialized from scratch but there's no disk nor interpreter hit after the first.

There are, of course, frameworks that simply handle HTTP requests directly (amphp, swoole) that operate as persistent application servers, so state is maintained.

> Does this model uses OS threads? Does it uses green threads?

No. PHP webserver backends are generally a long-lived forking model.

> I feel like the Go model is a way better model for server software than async

Swoole [1] offers a coroutine and channel model. It's incredibly fast and the techempower benchmarks [2] attest to the raw speed.

> It feels a bit weird to see how full of objects PHP is

Agreed. It's often way over the top with Java-esque OOP complexity. It does depend on the libraries in question but the popular ones are very heavy (Symfony). You can of course write very simple imperative code just fine too.

[1] https://www.swoole.co.uk/

[2] https://www.techempower.com/benchmarks/

Re: PHP is worth learning and using

#57

Earlier quoted context omitted.

But, what is, if not php? Do you shoot for what has had longevity, or what's rising?

Python, JavaScript, Java, C# have all had great longevity, and much more popular, and can do anything that you can do w/ PHP and a whole lot more. Encouraging new programmers to learn PHP is cruel.

Encouraging new programmers to learn Java isn't cruel? "Son, today is the first day of a long journey into enterprise software development. Yay"

It is cruel, and something Universities have been doing forever.

Re: PHP is worth learning and using

#58
post #33

Earlier quoted context omitted.

In theory, true. In practise, they are most popularly used for the Microsoft and Android ecosystems, respectively. I’ve reworded it to platform-oriented.

I'm not sure what you mean by platform-oriented.

Well, I’m not trying to invent scientific classifications here, but the common reason to choose one of said languages is to use them with the Microsoft/Apple/Android ecosystems, respectively.

Re: PHP is worth learning and using

#59
post #50
post #46

Earlier quoted context omitted.

But what is, if not Visual Basic? Do you shoot for what has had longevity, or what's rising? But what is, if not Motorola 68000 Assembly? Do you shoot for what has had longevity, or what's rising? Pointing out that there is not absolute certainty about what is the top choice for a better idea does not make php, or visual basic, or 68000 worth spending your time on in 2021.

Fine: python, ruby, go, rust, elixir, c, java, javascript, plenty more. Pick whatever you want. Just don't pick a language that is known to be on it's last legs.

Ya, but PHP is actually still being used in a lot of agencies and in certain types of work. Far more than elixer and rust, probably just below ruby.

Also I wasn't pointing out what you say, you're reading into it a bit. I haven't used PHP in a long ass time. But it seems like not a bad choice for certain markets, at least as much as Python and Ruby imo

Re: PHP is worth learning and using

#60
post #30

Earlier quoted context omitted.

Lots and lots of people do web stuff in Python. There are a whole bunch of Python web frameworks like Django, Pylons, Flask, etc. And there are big sites written in Python, too. Reddit, YouTube, some Google apps, Spotify, Netflix. Rust is still a bit young, but also has several web frameworks like Rocket. No big case studies that I know of, but Rust still has many more fields of applications than PHP does.

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.
Post reply on HN