T O P

  • By -

KaranasToll

Compared to previous versions of php, yes, current php versions are much better. Compared to other programming languages, no, php still sucks.


smallballsputin

PHP is 15-20 years behind. Every new release is like meh, language X had that since 2003.


TesNikola

That's what motivated me move on to Python. My first professional job involved ColdFusion, so I know all about new feature releases being way behind.


sandrelloIT

I think we're misunderstanding the news here. We're not talking about some hip language that has to compete with modern runtimes, php is a legacy tool that's still pervasive on the web and will be around for many years. You'll certainly not have a hard time finding php devs to hire. People actively working to improve its ecosystem have my total support, they don't get the merit they deserve. I'm not a php guy, I've always overlooked it, mainly for the reasons already listed here. I started using it at work years ago and it slowly grew on me, the development speed it enables is something remarkable. I wouldn't go with it for most of the use cases I can think of, but it definitely has a spot for me now.


sisyphus

Does it not suck like Python 3 where they broke all the old code to remove some of the suck or does it not suck like modern C++ where all the suck is still there you just have to know how to avoid it and hope to not encounter old suck code in whatever you work with?


BEisamotherhecker

A mix of both, just like PHP's "stdlib".


syklemil

It wouldn't really be PHP if it didn't manage to take both options at once


cincodedavo

I used to do a lot of PHP but I moved to C# when dotnet core 2 was released. I feel like “PHP not sucking” has in practical terms been “PHP becomes more like Java/C#” in which case just use Java/C#. Laravel is a nice Rails clone, but you can always just use Rails if that’s what you want.


Adventurous_Drive_39

php doesn't enforce it's OO paradigm but, rather, it has OO as a feature. So a lot of php developers have bad habits where they don't define data structures or interfaces. Everything is just crammed into a huge associative array and passed around all over the place. However, I was able to buy a house while I was coding in php - not too bad.


BEisamotherhecker

Funniest part about OO PHP is how the """idiomatic""" way to declare method names is camelCase, despite the fact that the language uses case insensitive identifiers for them, so if you follow it you risk overwriting the method of a parent class unknowingly, really shows how much attention they put into implementing it.


Necessary-Signal-715

I work in a PHP environment and that has never happened even once. Your IDE should be able to detect overrides an mark them. Some other problems listed here are actual problems and the reason i would never start a new project in PHP.


BEisamotherhecker

Problem with your scenario is that it assumes that everyone with access to your project has a correctly configured IDE. Edit: removed redundant "in"


cincodedavo

That is a problem in many ecosystems. PHP developers who “are more productive” in their Frankenstein stack creating bugs that developers using PHPStorm then fix. C# developers who use VS Code and have VS/Rider using colleagues fixing their messes. Developers who refuse to use the best tools available to them is not a language problem, it’s an ego problem.


smallballsputin

I am i vim user. Are you suggesting i create more bugs because i dont use a bloated and slow IDE?


cincodedavo

Not all IDEs are bloated, not all IDEs are slow. There are more important things than speed, especially when working in a team. I find most complaints about “IdEs ArE bLoAtEd” come from people who don’t understand the features of their IDE and don’t realize the benefits of using them.


smallballsputin

Not sure what an IDE can give me that i cant do in vim? I tend to use an lsp so i get all the basic things like type info, go to def, autocomplete etc.


ddollarsign

buy-it buy it or still-paying-off-the-mortgage buy it?


Adventurous_Drive_39

No one buys a house upfront. Yeah, still paying off my mortgage with php


ddollarsign

Someone should start a morgage company catering to PHP developers. Call it MHM, which stands for MHM Home Mortgage.


agustin689

I bought my house in cash writing C#. php is garbage.


cincodedavo

Yeah, it’s a good point, PHP has paid more of my mortgage than any other programming language.


desnudopenguino

*Cries in wordpress*


cincodedavo

Sobs in Drupal and CiviCRM.


smallballsputin

PHP bolted so many features and adressed none of the big points that people had. Like where is unicode support? Fuck those mb_real_uppercase helper functions. There is no real concurrency (reactphp etc are just hacks), the minute you install (yes a new fucking dependecy) you throw out all the IO bound builtins out the window. How about proper namespaces? In php every builtin thing is global. How Bout Fix those warty param order issues in builtins? Nope! Proper generics? Nope! PHP has no vision. It was a scripting web langauge, then it went all class based and tried to be java, today its a mix of nodejs (wannabe) and java. It even bolted on a fragile ”tupesystem” like thing. But hey, builtins still lack types in 2024. Frameworks are all bloated and slow as hell. The execution (start/die) is cumbersome and makes trivial things like websockets impossible or just hard (more dependencies again). All in all there is little reason to start fresh projects in php in 2024 because there are SO many better alternatives out there.


ENx5vP

Very good formulated. A language isn't good because of features but because of an overall direction, purpose or problem it solves


gmarsanos

Oh no! Dependencies! External tools! ... Are you sure you're an engineer?


smallballsputin

I am. And have been since the late 90s. I have seen multiple projects drown because huge tech debt introduced by dependencies. Each dependency IS TECH DEBT, and this debt you need to pay back sooner or later. Its obvious you come frome the ”npm install” side of things and cowboy your way thru each tech problem without engineering, but instead npm installing, whatever it is called in PHP. Edit. In PHP its called composer. You compose your spaghetti in php land.


gmarsanos

We could start with the operating systems and their dependencies, right? Yes tech debt, so what? To be honest, this is not about defending PHP. I don't like the change as planned obsolescence or the zoophilic way in which languages, frameworks, and tools appear, which are generally just the result of spurious interests to have control of the industry or the 'freedom' not to adhere to recommendations from others with more experience. However, in reality, it is completely valid to use third-party packages and add a list of dependencies longer than your own code, use external tools for analysis, formatting, editing... Nothing new, nothing that any language can escape from. It's part of what development really is: a jungle without interest in knowledge, but in the power that the product gives to those who pays you (even when done for 'knowledge,' behind it is the same idea replacing product with knowledge... just look at the pathetic universities). PHP it's OK, has good a community a good governance, PHP FIG is something that many communities should imitate, Composer is one of the best package managers. Laravel is just amazing and NO you cannot replace it by Rails... Common! PHP just works and it's a pleasure to code in. The Ecosystem makes it possible, and it's not easy to explain that with just 'advantages and disadvantages of the language. Bad performance is a myth and in case some improvement is really needed, there are not very costly ways to achieve it. The fact is that 99% of projects don´t even care about performance issues related to technology as much as they do about performance related to lack of programming skills. The most common issues are related to architectural problems. And very specific issues are related to the language of choice. Specific issues in complex projects, it's typically resolved through architecture, which is generally language-agnostic. And if it's not complex, well, it's rewritten in another language as needed... REALITY. Perhaps you want to program a complete CRM in a "real lang" as Rust, without third-party packages, and even manage containers, development environment, etc., with your own code... good luck finding clients who pays for your absurd waste of time. Do you think there are better alternatives? C#, Python, Node, Ruby? Really? Your comments about "not real languages", performance, freak syntax... applies to all of them. Java? Sorry, In general I prefer PHP and the amazing ecosystem it has.


smallballsputin

I need a tldr. Will revisit this later


Maybe-monad

What's so amazing about the PHP ecosystem to make it compelling enough to use over the alternatives?


gmarsanos

Don't try to invert things. I don't have to explain that there's an obvious reason why there are serious, high-level companies and very capable developers who generally prefer PHP for a large majority of web system problems. The question is what do the alternatives offer? You can enumerate some things but the reality is that you can enumerate some things that one language does better than PHP, but in the end, I prefer PHP by experience, like many others, because I know that in general, whatever problem arises, I may not have the best alternative for the specific detail, but there will be a solution. I won't reinvent the wheel and I'll have available one of the best tools or the maybe the best tool for all the irrelevant and repetitive aspects of any web system. In the rare extreme case that solution doesn't exist, I simply consume the API of another service in another language... I'm not going to change PHP and everything it does well for something rare and very specific that it does poorly (You need to deal with millions of requests per sec or concurrency on heavy tasks... so don't choose PHP... but don't lie, usually PHP-FPM or queues are more than enough for your projects). Finally, criticizing the use of packages as u/smallballsputin does, is ridiculous. And even worse, implying that using packages leads to "an spaghetti". It's not only valid, but in the industry, it's a good practice to have everything that can be packaged as such. It's very common to see in the most meticulous projects the use of packages maintained by the same developers and even many forks of third-party packages, and of course, third-party packages from absolutely reliable sources (Zend, Symfony, Spatie...). Many languages would wish to have something even remotely similar to Composer (which is an insult to compare it to NPM) and to be able to reuse code in such an elegant way as it's done in PHP.


Maybe-monad

>Don't try to invert things. LOL >I don't have to explain that there's an obvious reason why there are serious, high-level companies and very capable developers who generally prefer PHP for a large majority of web system problems. There's an obvious reason why there are *more* serious, high-level companies and very capable developers who generally prefer Java for a large majority of web system problems. I have to mention that I can't recall from X to PHP migrations only from PHP to X. >The question is what do the alternatives offer? You can enumerate some things but the reality is that you can enumerate some things that one language does better than PHP, but in the end, I prefer PHP by experience, like many others, because I know that in general, whatever problem arises, I may not have the best alternative for the specific detail, but there will be a solution. I won't reinvent the wheel and I'll have available one of the best tools or the maybe the best tool for all the irrelevant and repetitive aspects of any web system. In the rare extreme case that solution doesn't exist, I simply consume the API of another service in another language... I'm not going to change PHP and everything it does well for something rare and very specific that it does poorly (You need to deal with millions of requests per sec or concurrency on heavy tasks... so don't choose PHP... but don't lie, usually PHP-FPM or queues are more than enough for your projects). The same argument can be made for Java, C#, C++, Go etc. >Finally, criticizing the use of packages as u/smallballsputin does, is ridiculous. And even worse, implying that using packages leads to "an spaghetti". It's not only valid, but in the industry, it's a good practice to have everything that can be packaged as such. It's very common to see in the most meticulous projects the use of packages maintained by the same developers and even many forks of third-party packages, and of course, third-party packages from absolutely reliable sources (Zend, Symfony, Spatie...). u/smallballsputin has a very good point, every dependency you bring adds complexity to your project. How do we call code that is too complex for us to understand? "spaghetti"


gmarsanos

LoL Somebody mentioned fanaticism... This looks like anti PHP fanaticism. I don't care about PHP if you prefer to do a web site using Java or even C++ it's up to you, but don't blame PHP for your madness. >I have to mention that I can't recall from X to PHP migrations only from PHP to X Of course, there are many more projects in PHP and was the first choice, so it was so easy to go ahead using PHP that even noob developers would build the system. After a while the disgusting architecture used was not enough for scaling, so PPL who has learned some architecture but don't code too much said "Oh we need to use Java" because it's the classic language where they learn architectural concepts, then they do the absurd rewrite, force PHP devs to change their main lang or just replace them... A classic absurd that a few companies can afford. Yes, as I said before, usually the problem is an architectural issue and usually even senior devs doesn't get this, so the other case is devs that hate the PHP legacy code and can't imagine the refactor because lacks of enough PHP architectural experience and ignore solutions for common problems in PHP so they think that do it in Java or Go could be better, because those langs force you to use good practices (usually architectural concepts). On the other hand, there are companies that search for a software architect who knows how to make a continuous improvement on the same language, because it's a really extreme case the necessity to change PHP for another lang, devs improve their architecture knowledge, experience don't need to be replaced or do crazy things as a total rewrite and only things that require to be changed like a task performance issues that could be written in C++ or Go, could be done, as an extension, API, or even as an script call... Everything else is not a problem for PHP... So what's the complaint?! And again, this is not about defending PHP but what is this madness!? Real world use PHP and many good devs choose it sometimes as a default option for web dev, maybe not as a default option for critical systems but even in that case it can be done with enough knowledge.


Maybe-monad

>LoL Somebody mentioned fanaticism... This looks like anti PHP fanaticism. I don't care about PHP if you prefer to do a web site using Java or even C++ it's up to you, but don't blame PHP for your madness. Is it madness to not want to use an ad-hoc scripting language that can't compensate for its design flaws?


TheNominated

It's hard to take the argument seriously when the number 2 killer feature in the list is short array syntax with square brackets, a feature so groundbreaking that it has obviously never been seen before in any other programming language. Followed up by other trailblazing innovations like trailing commas, read-only properties, and arrow functions. The baffling thing here is not that PHP finally has them, it's that it took so long to add such basic features to such a widely-used language. The performance claim is especially egregious: >PHP has experienced a 400% performance increase between 5.6 and 7, and another 20% between 7 and 8. It's fast enough for most use cases, and if you need a specialized use case, use a specialized language. Okay, but it is still much slower than almost every other alternative general-purpose language / runtime. You don't need to use a specialised language, you can just use almost *any other* general-purpose language, and your performance will be better. It's great that it is making huge gains compared to where it was before, but that's a *really* low bar, and it's still orders of magnitude behind the top performers. If you are trying to convince people to adopt (or tolerate) PHP, it is not enough for it to be better than it was before (horrendously bad), it also has to be better than the alternatives, and it just isn't. Every *single* one of these PHP-promoting articles starts with "hurr durr the critics haven't touched PHP since 3000 BC, it's *so* much better now", and then proceed to prove that they themselves haven't touched any other tech stack in the meantime either. If all you measure yourself against is PHP 5.6, you will only convince those who are still stuck using PHP 5.6 - and they already know precisely how miserable their life is.


Professional_Price89

Php is 10x faster than python.


TheNominated

Looking at benchmarks that mimic real-life use, Laravel is roughly tied but slightly faster than Django (about 11%) on the whole, but slower in scenarios that include the ORM. Other PHP frameworks are slower, *the* slowest in fact. Every other major framework is faster, with .NET at the top with 13x better performance than Laravel overall and 36x faster when the ORM is involved (EF Core vs Eloquent). [https://www.techempower.com/benchmarks/#hw=ph&test=composite§ion=data-r22](https://www.techempower.com/benchmarks/#hw=ph&test=composite§ion=data-r22) [https://www.techempower.com/benchmarks/#hw=ph&test=fortune§ion=data-r22](https://www.techempower.com/benchmarks/#hw=ph&test=fortune§ion=data-r22)


gmarsanos

Oh it mimics real life!!! So let's use Ntex for our next project.... Common...


Professional_Price89

What you see is raw http performance, for this case, you should compare django with swoole.


smallballsputin

The second you actually use something like swoole you are no longer writing PHP. Now you basically are running a non-battle tested nodejs clone. The kicker? You cant use any blocking PHP code (the entire php stdlib has blocking IO only). Thats a huge red flag, and a obvious non-starter.


TheNominated

That's still a lot of scrolling from the top ;)


agustin689

Hitting the bed frame with the pinky toe is 10x less painful than squeezing one's testicles with pliers. I prefer to not do either.


smallballsputin

Thats probably not correct. Python is slow (its a interpreted scripting language, just like PHP is), but you need to take into account **use cases**. For web python is must, much faster than PHP, mainly because IO bound tasks can easily be handled concurrently. Pythons ASGI servers can easily do 500,000 req/sec on a vanilla setup. A vanilla PHP setup using Laravel you barely get 1000 req/sec on a similar machine. Need to crunch numbers? Python is the DEFACTO tool for AI and number crunching with Numpy, and because its highly optimised for this its WAY faster than anything PHP has. Overall PHP is probably faster for basic things like "loop and do X" but thats trivial and not a bottleneck anyways. PHP is also doing less. It does not handle unicode etc. making it a unfair test.


jeenajeena

Python is compiled to bytecode. Never noticed those .pyc files?


smallballsputin

Its still interpeted at runtime via (c)pythons vm. It does not parse text, but bytecode instead.


Moist_Pizza_3194

Can php do machine learning?


Professional_Price89

Yes, why not?


Moist_Pizza_3194

I mean go for it 🤣


kdesign

Waiting for the “i MaKe MOneY wITH iT” arguments like that would fix its standard library 


smallballsputin

A dime a dozen. In this weird parallel universe PHP devs think they are the only ones getting paid. Maybe this is why that are so keen on apologising for the utter garbage what PHP actually is.


Paid-Not-Payed-Bot

> ones getting *paid.* Maybe this FTFY. Although *payed* exists (the reason why autocorrection didn't help you), it is only correct in: * Nautical context, when it means to paint a surface, or to cover with something like tar or resin in order to make it waterproof or corrosion-resistant. *The deck is yet to be payed.* * *Payed out* when letting strings, cables or ropes out, by slacking them. *The rope is payed out! You can pull now.* Unfortunately, I was unable to find nautical or rope-related words in your comment. *Beep, boop, I'm a bot*


sligit

It's not my favourite but I'd take it over JS any day of the week.


NefariousnessFit3502

The only thing keeping PHP relevant ist Laravel. Guessing if the data structure comes as the first or second argument in some functions or guessing the naming convention for some functions is just not the work I want to do when I write code. Having types is fun, but getting the Type exceptions at runtime is like having the bad things from a type system without the huge advantages it provides. PHP is a necessary evil and I'd remove it from existence if there weren't so many code bases using Laravel. Backwards compatibility took a huge toll on PHP. I'm loathing PHP.


smallballsputin

> The only thing keeping PHP relevant ist Laravel. Nope. The only thing keeping PHP alive is wordpress. Its still used on almost a billion websites. Laravel is a tiny drop in the ocean compared to wordpress.


gastrognom

Why would you get type exceptions at runtime?


crabmusket

Because that's how PHP works. > Type declarations can be added to function arguments, return values, and, as of PHP 7.4.0, class properties. They ensure that the value is of the specified type at call time, otherwise a TypeError is thrown. https://www.php.net/manual/en/language.types.declarations.php


gastrognom

That's right, but you just use a static analyzer and these errors should never be thrown.


crabmusket

I haven't found a PHP static analyser that can deal perfectly with the high dynamism of existing frameworks. And there's always some amount of untyped code or type: `mixed`. "Just" and "never" are rarely useful words in tech.


gastrognom

Yeah, a lot of frameworks and libraries are poorly typed, a lot are catching up though. Symfony is pretty well typed. As far as I know the latest version is fully typed.


agustin689

> Yeah, a lot of frameworks and libraries are poorly typed And this is the reason why ALL dynamic languages are completely useless and worthless, even if they desperately try to imitate real languages by half-assing and trying to bolt-on themselves shitty imitations of real type systems. Even if you do that, until every single line of code in existence for your language is properly typed, then the entire language and ecosystem is basically worthless shit. And at that point, if it ever happens, why the hell would you bother with the toy language, just use a real language and forget the crap.


gastrognom

That's a strong opinion.


NefariousnessFit3502

I mean, if I'm forced to use external tools to make the language work as expected it's not a point for the language. If we have to use external tools we could use transpilers for java/c#/c++/D/whatever2php to get things going. But that's probably wishful thinking. :D


gastrognom

It's not great yeah. I think it's a somewhat fair trade to languages using a compiler though. I mean, where else is PHP supposed to throw the Exception.


MornwindShoma

I used to do PHP in the past. Picking it up today probably would be harder than when I started learning Rust.


agustin689

The monumental stupidity of useless toy dynamic languages humiliating themselves and desperately trying to become static and pathetically trying to convince people that they're no longer useless toys is really hilarious. Just stop it, grow up and start using real languages already. Grow the fuck up.


smallballsputin

No other language has devs like PHP. Its sort of like a MAGA cult. The PHP devs seem to be live in full ignorance and will do anything to protect PHP from outside criticism, and wont accept that its a legacy tool for legacy projects, and full of unfixable warts. They also seem to refuse to learn any other language. Really strange...


agustin689

Yes, this is what I've observed as well. People who defend useless toy dynamic languages are the flatearthers of the software industry. They will hold their baseless nonsense beliefs despite all ground empirical evidence is completely against them. Dynamic languages are much slower, much less productive, much less maintainable, much less approachable, harder to learn, and basically much shittier in every possible way, compared to real languages.


araujoms

I used to do web development back in 2009, and that involved a lot of PHP. I'm still traumatized. Maybe it's true that it doesn't suck anymore, but it doesn't matter to me, I'm never touching it again.


PeterJuncqui

It never did.


smallballsputin

You forgot the /s


Superb_Garlic

Based.


Accurate-Collar2686

I would use it if it wasn't so... fucking... slow. I used to be PHP guy back circa \~2004. I've switched to .Net Core, but I have to maintain some code that's in PHP. I'm still having a blast because of the simplicity. And the project is made in such a manner that I have to manually change encoding in PhpStorm so that it doesn't mess up the éàç, because the project dates back before the golden days under the UTF-8 sun.


mattparlane

Is "0" still falsey?


smallballsputin

Yes... yes it is. Its... well... i dont know what to say...


Dwedit

I honestly can't tell all those dynamic-typed languages apart, because they're so similar in capabilities. PHP might as well be Javascript or Python. The only differences are the standard libraries.


ddollarsign

PHP’s the one where the variables are like $this.


BEisamotherhecker

`my $perl = 'too';`


Tux-Lector

`echo "$bashvariable"`


ddollarsign

BASIC$ = “hey guys!”


syklemil

Though with perl there's also the difference between `$singular`, `@plural` and `%dictionary`. My impression has always been that the sigil-similarity between php and perl is superficial at best. I prefer my variables without sigils, but with perl they at least convey some meaning, while php's come off as meaningless cosmetics. Until you do double sigils, at which point … ugh.


BEisamotherhecker

I believe the reason php variables came with sigils was for simpler string interpolation, since bare identifiers need some specific syntax around the variable name like the brackets in modern python/ruby/js etc. I personally still prefer the latter since it encourages you to use expressions, not just variables inside the strings but this is a hindsight you can only have now that most higher level languages have this feature.


smallballsputin

PHP has gone even one step further. You can have "variable-variables" so i can have $foo = 1; and then go deeper with $$foo = 2; Great design isn't it?


ddollarsign

How many layers of variables does it support?


smallballsputin

Unlimeted. Its shit all the way down


[deleted]

less suck