Live data from Hacker News

PHP is worth learning and using

bulletproofphp.dev

271–280 of 468 posts

Re: PHP is worth learning and using

#271
post #265

Earlier quoted context omitted.

Ok, I'm just trying to understand. Not trying to make you create a scientific classiciation :D I just disagree as a .NET developer.

I could be mistaken, but I can’t remember last time I heard of a C# project that wasn’t either targetting Windows as a platform (whether server or desktop) or running against some other Microsoft-thing like Xamarin. In the early days of Mono, there were some attempts at using C# outside Microsoft circles, like building Gnome-apps with GTK#, but most of those projects have faded away.

I have around 500 c# .net lambdas. And several linux servers with .net on it. Also do almost all of my work On linux. Tho I’m starting to switch back to windows 11 with wsl2…

Re: PHP is worth learning and using

#272

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…

> 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, after all these years I still need to see a story of a startup that failed because they chose the wrong stack. There are some blog posts with spurious claims in this sense, but really, when has a startup with good product-market fit and a finely designed product ever failed because they chose PHP instead of something else?

Re: PHP is worth learning and using

#273

| php is fast. https://benchmarksgame-team.pages.debian.net/benchmarksgame/... it's faster than python, but my grandma is too and she died in 1993. However, function calls are extremely slow. If you would bench something like a naieve fibonacci implementation (or ackermann's function) you would be surprised.

I have stopped trusting the aforementioned link because they play dirty games with benchmarks, most of the times.

Let me give you an example;

  https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-python3-2.html 
and

  https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-perl-4.html
The Python code uses ctypes, thus the unfair marginal difference.

I have seen the same unjust comparison with the majority of the examples and decided to stop relying on this page for validating programming language performance.

Re: PHP is worth learning and using

#275

Earlier quoted context omitted.

> You seem to be referring to an area where people pay pennies + have almost zero programming experience so they want to launch a project with clicks. Over my career, I've worked with companies using PHP in sales. One of those had over a million customer subscriptions, the other was a multi-national looking at PHP for a greenfield e-commerce project. I noticed working in Europe some high-growth agencies that use PHP.…

> It's traditionally run as a shared-nothing single-threaded script, which makes it easy to reason about, and in real life has proved to be a stable way to run things in production. I think we have a vastly differing definition of "in production". I'll agree PHP was good enough for plenty of things, and likely still is. But good enough in general to run things in production as it's understood today? You'll find that…

> I think we have a vastly differing definition of "in production".

Running software that customers use, directly or indirectly.

I've supported servers running PHP and Java software in production. The shared-nothing per-request nature of PHP meant I didn't have to deal with a bug in a misbehaving library causing memory leaks and taking down the application server.

> That's what I mean, not only for PHP but for like 99% of all programming languages: they play catch-up, waaaaaaaaay too slowly and gradually, with things that should be baseline by now.

PHP's problem domain has been web-based e-commerce and content management systems. In this area, PHP powers most of the web. You'd want to use PHP in this field, over other languages. Every improvement around PHP has been to advance this goal, such as the recent addition of gradual typing. There's no question of "catching up" in this area. That it is broadening out into different areas, great.

> You seem to insist that statistical success speaks something of the merits of a technology.

If the technology doesn't have a marketing department, or large companies forcing people to use it, then arguably, this does, as otherwise people would just use something else.

There have also been many other qualitative improvements to PHP over the years. I also mentioned its shared-nothing architecture, which is a qualitative, not statistical aspect behind PHP's success, as it has proven to provide stability in production. People use PHP because in certain problem domains, it is qualitatively, and statistically (assuming you mean, it benefits historically from a wide number of successful, maintained libraries) the best tool for the job.

Re: PHP is worth learning and using

#276

Hmmm... Most points in this article are shouting "yeah we have those too!!" but it didn't give any convincing arguments why I (or anybody who doesn't already know PHP) would like to learn and use PHP over other decent modern languages and ecosystems, which happen to have those points as well.

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)

Re: PHP is worth learning and using

#277
post #147

Earlier quoted context omitted.

> Hey presto, you have a functioning web shop, business website, charity home page, or whatever other thing you want. If we're talking about simple templates to open a store or a simple landing page there are so many no-code options like Wix/Shopify/SquareSpace/Square that I don't think PHP offers any significant advantage.

I believe at least one of the options you listed is actually built with PHP (Shopify).

Shopify is famously a Rails shop, but it is likely that a couple of the products on that list are built in PHP.

Re: PHP is worth learning and using

#278

Earlier quoted context omitted.

Good jobs though? Lots of PHP jobs in Canada, but the salary is nearly universally always laughably low.

IDK what is a good salary in US/Canada, I live in European Union. My salary as WordPress developer is more than 4,5k USD/month and I see job offers with 8k USD as well (still for WP developers, this is my specialization and I know this field the most; I expect for better recognized PHP fields like modern frameworks like Laravel it could be more) And yes, 4,5k USD/month is massively good salary for Europe. On the othe…

4,5 K USD/month is 54K USD/year gross which is 47K EUR/year gross. That's not massively good salary across ALL Europe.

In eastern and southern europe: that's probably good for a junior engineer, and perhaps average for a senior

In northern europe: that's probably average for a junior, below average for a senior

Re: PHP is worth learning and using

#279

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.

Yes, I have. I recently programmed PHP after 10+ year break from it and while some things were fixed many of my old issues with it remained. I would not recommend PHP to anyone unless they have an existing code base in it.

Re: PHP is worth learning and using

#280

| php is fast. https://benchmarksgame-team.pages.debian.net/benchmarksgame/... it's faster than python, but my grandma is too and she died in 1993. However, function calls are extremely slow. If you would bench something like a naieve fibonacci implementation (or ackermann's function) you would be surprised.

(naieve fibonacci) like this: just did some measurements on my laptop: | Language | n | time(s) | |----------------------+----+---------| | php (7.4.25) | 42 | 422.0 | | python3 | 42 | 90.0 | | haskell (ghc -O3) | 42 | 13.8 | | f# | 42 | 5.6 | | ts | 42 | 2.8 | | ocaml (ocamlopt -O3) | 42 | 0.98 | | C (gcc -O3) | 42 | 0.66 | (edit: added php version in table. )

This is what I get locally:

    time php fib.php 42
    23s

    time python3 fib.py 42
    1m1s
I suspect that you're doing something very wrong, like running PHP with an active debugger or similar.

If we're talking in comparison to slow interpreted languages like Python, then function calls in PHP are not particularly expensive. Debuggers can make them quite expensive though.

Edit: Just to note, PHP's execution time drops to 4s with enabled JIT.

Post reply on HN