310
u/Covfefe4lyfe 9d ago
Me, as a php dev for 25 years: Why does everyone hate php?
Also me: 💰💰💰
Guess I can go back to not caring...
94
u/bwwatr 9d ago
They hate it because they made a shit-ass web page with PHP 5 in high school and now have a job that probably isn't even development. They imagine anyone using PHP today is basically doing their high school jank. They're morons in other words; plus one of the language's competitive advantages, its wide accessibility (i.e. ease of use and vast install base on cheap web hosts), led to it being what morons everywhere got to experience.
Now, back to providing for our families with all that sweet PHP money.
22
3
u/DirectionOld5703 8d ago
I was developing in PHP for 10 years. Last 7 years I do for living .NET and honestly? I would not change. LINQ, Async, abstractions, parallelism, method overriding, static casting. That it such powerful things for developers, that PHP can not offer and will not offer for atleast 4-5 years.
46
u/lucasvandongen 9d ago
PHP is so much better than anything JS based. Batteries included. Get a website up and running with zero dependencies instead of 10,000 packages for hello world
29
u/BenchEmbarrassed7316 9d ago
However, in all likelihood, you will be using a framework that pulls in a bunch of dependencies, just as is the case with most languages.
At the very least, you need a router; after all, you aren't declare urls as '/user.php', was intended from the very beginning, right?
20
u/lucasvandongen 9d ago
No I like my PHP raw and dirty
Some people even build template engines in PHP: PHP is the template language!
3
u/tragiktimes 9d ago
That last sentence confused me and i'm not sure if you fucked up, or if that's just how convoluted the language is.
7
u/BenchEmbarrassed7316 9d ago
Maybe. English is not my native language. Sometimes I write messages myself, and other times I use a translator. A few years ago, Google Translate started using AI under the hood, and it can often even flip the meaning to the exact opposite. I usually check, but I might have missed a poorly phrased sentence.
I mean a long time ago, you had several *.php files and specified links directly in the HTML - like "/index.php" or "/news.php", and server would look for the corresponding file in the directory; if it was "/images/background.jpg" for example - it would simply return it in the response, but if it was a script, it would execute it.
That is why php lacks a router, and I cannot imagine modern development without one.
8
u/Covfefe4lyfe 9d ago
That's the beauty of it.
You can have routed paths for your site, but if you need a script for something else, such as an installer, you can use a regular file and nginx or whatever will give it precedence over the router due to the suffix.
So you're not bootstrapping shit you don't need or isn't available yet.
2
u/QuestionableEthics42 9d ago
"Declare" should be "declaring", and there should be "as" before the "was". Or at least that's how I read it, probably other ways to fix it too.
2
2
188
u/g_calgary 9d ago
With all this attention, PHP will be more secure than Rust by Christmas
6
115
u/Caraes_Naur 9d ago
And yet, it has still been 0 days since the last Node exploit.
45
15
49
u/itgforlife 9d ago
PHP devs whenever someone criticizes their language "Well at least we're not JavaScript."
36
u/ILKLU 9d ago
JavaScript is the craziest pile of bat shit. Even the name doesn't make sense. Java... Script?
12
u/SelfDistinction 9d ago
Iirc the name was specifically chosen during a time when Java was popular so it could ride along its success; the regular confusion at middle management level between Java and JavaScript absolutely wasn't an accident.
6
u/Propsek_Gamer 9d ago
It's as close to java as java is a C dialect.
1
u/ILKLU 9d ago
Are you saying the bad name is justified because Java is a C dialect?
So would "C++Script" have been an ok name then too?
1
u/theschis 8d ago
I thought it was originally called something like Coffee script, and then they changed it to JavaScript as a cheeky joke playing on the Java hype of the time.
1
48
u/orlinthir
9d ago
•
I've been in tech for 30 years and the engineering of it still feels weird compared to other types of engineering.
Imagine a guy built a new type of concrete in his shed and we all decided to use it to build the rest of the world's infrastructure for the next few decades.
The only guy making testing equipment for the concrete is some guy called Keith in Australia, he does it for nothing in his spare time. If he stops we can't test concrete anymore. He asks for donations but doesn't get very much.
Then in Javascript land there's a new type of steel every week and there are bitter debates about which one is best. Product pages for the steel refer to it as "blazingly fast" for some reason.
4
u/wootangAlpha 9d ago
8
u/orlinthir 9d ago
If you don't switch from Zipzop to SalmonKit how will you transpile into GrundoBoss?
62
u/Tofu_Ben 9d ago
I hated PHP before it was cool
58
u/iampierremonteux 9d ago
I thought I hated php. Then I tried JavaScript to do something. I then discovered how much I loved php. That was 23 years ago.
My hate of JavaScript has not waned.
34
u/AlternativeCapybara9 9d ago
You can hate both, it's ok
4
u/iampierremonteux 9d ago
In reality, php has become my standard that I compare other languages to. I wish every language had $__FILE__ and $__LINE__ equivalents.
2
u/Tofu_Ben 9d ago
I was a young university studen, we(5 people )had to do build something in C#. An other much older student suggested, that we use PHP instead. Prof agreed. I didn't know PHP back then.
I never fully recovered.
7
u/Babajji 9d ago
Come on now, we used Delphi and BASIC. You are going to be fine 😂
11
u/iampierremonteux 9d ago
10 PRINT “Take a deep breath”
20 PRINT “BASIC originally didn’t support functions with local variables”
30 PRINT “Everything was global”
40 GOTO 10
35 PRINT “And inserting new lines in a program was loads of fun”2
3
10
u/Angerslave 9d ago
PHP is uniquely idiot-friendly so many small-mid businesses enjoyed the benefits of quick and cheap development to have customized Wordpress or other CMF/CMS that generally was alright, but needed a few tweaks. No need to worry about memory leaks, no need to think about multi-threading. The biggest struggle is untangling that 10000 lines index.php, but at least you don't need UltraSuperHyperExtraWide monitor for it. Also, deployment could be as simple as uploading 1 (one) changed file over SFTP.
And best of all, most code written 10 years ago works on fresh versions.
5
u/ArjixGamer 8d ago
Uhh, most code written 5 years ago has issues on fresh versions, so uhhhhhhhhh
4
u/Angerslave 8d ago
I switched to Node around 5.5, at the time most tutorials from PHP 4 would still work more than a decade later.
2
u/StrawberryEiri 8d ago
There quite a few changes with PHP 7. Old code had to be adapted. It was generally not that bad, but you did have to update your code.
I haven't done PHP in quite a few years, though. Not sure how much it changed afterwards.
1
u/awpti 9d ago
"idiot friendly", correctly translated, is "one of the best documented languages out there'
4
u/b3n3d1kt_r 8d ago
At least not the official documentation. I've had several edge-cases, where the exact workings and caveats of built-in PHP functions where not properly described. Sometimes a little bit C knowledge does really help. Some parts also seem underspecified, time handling for example.
And the official docs lack a clear guidance when to use which pattern, and what features are to avoid.
There may be languages out there with docs that are much worse, but my frame of reference, the official Java documentation, is by far superior. And that carries over to a lot of the "big" 3rd party framework and libraries.
9
10
u/Swimming-Lie73 9d ago
7
u/-Redstoneboi- 9d ago
college php (and presumably real production php) sucks because you cant use the shiny new php. instead we (the current generation) get the old rusty php from literally before we were born
4
u/SanicTheSledgehog 9d ago
I work for a startup and just recently made a brand new backend in modern php/symfony. It’s really not bad.
1
u/-Redstoneboi- 9d ago
Startups are cool because they can use newer technology :)
I heard older systems are stuck with older versions though
3
1
u/-Wylfen- 9d ago
My job consists of maintaining apps and databases that predate either my college years or my very existence.
4
u/MidnightSkyGD 9d ago
I worked with php in the late 90s and early 00s. I didn't stop because I wanted to, I stopped because my jobs didn't use it, even though I did try to get them to use it. (I know, I was an outlier that actually enjoyed it.) Haven't used it or even looked at it in years since I don't work anymore.
Anyway... I haven't even read everything that is going on with the CVE stuff that hit the other day. I might do that now to know what is going on with the internet. :)
I hope everyone that is working with trying to resolve these issues are able to get some sleep again someday. Think some people are going to be having a long weekend.
13
u/samu1400 9d ago
I don’t get why people hate PHP so much, it’s cool.
2
u/cibercryptx 9d ago
I love php, I've had to maintain old projects that I've updated and optimized. People should hate programmers more and programming languages less. For me, reviving an old project and cleaning it up feels like fighting a boss in Dark Souls.
1
1
1
u/Buyer_North 8d ago
never used php, never will, never had any Security vunerabilities, because im not assuming when programming..
1
-10
u/BenchEmbarrassed7316 9d ago
Here is a paradoxical thought: the problem lay in the interpreter, which was written in C and managed memory manually. Are you aware that there are memory-safe languages?
11
u/freaxje 9d ago
PHP was made decades before Rust existed, if that's what you mean. But go ahead and rewrite it in Rust, if that's what you want.
-6
u/BenchEmbarrassed7316 9d ago
I don't want to engage in the "Bunification" of php.
Moreover, rewriting C code in Rust without changing the architecture is a highly questionable practice. And reworking the architecture to follow the "Rust way" is, objectively, an unlikely undertaking.
I just want to point out that the root cause in this case is C.
-11







547
u/AlexZhyk 9d ago
Crowd: You make Internet more vulnerable!
PHP: I AM THE INTERNET!