PHP sucks

ITT we hate on PHP

Other urls found in this thread:

gitgud.io/chiru.no/chiru.no
twitter.com/SFWRedditImages

Ugh, how embarrassing. I wrote that over a year ago.
I mean, it's correct, I still want PHP to be a lot more self-commenting (via generics, enums and declarations for complex types like function signatures) and a split between hashmaps and proper arrays (backwards-compatible, of course) and hopefully a better standard library, however...
That was an embarrassingly dumb way to phrase this. I'm ashamed.

>>>/wdg/

>language isn't even transitive
Dropped

Don't be too ashamed, user. I think your post has that 2007 Sup Forums rage vibe that elevates it above the merely immature shitposts. Better tell us, what do you think of PHP now?

>hate PHP
>like Ruby/Python
I bet that's you, OP. Dumbass.

Well, I still think it's pretty bad. It DID get better over time. With every release since 5.3, the language slowly edged away from "Absolutely unusable garbage; Non-programming language for non-programmers and non-programs" towards "Flawed, but it does the job". I've gotten a lot better at dealing with since writing that post. And if you know where the mines are, a minefield (Which is what PHP's standard library is) isn't even that dangerous.

I mean, to use the language properly, you NEED to use composer for autoloading and use a rather big abstraction layer of libraries like symfony/http which basically just re-implement PHP's broken userland in a modern, non-quirky, but also much slower manner.

The thing that bothers me the most is what I wrote in that comment - the lack of typing. Not just type checks - runtime type checks, I don't even care that much about it. Compile time checks are obviously impossible because of how dynamic the language is. We'd need a major revamp like Facebook's hacklang for that. And the core devs are in favor of runtime checks anyway for some reason. We saw that when they implemented type hints for parameters.

But what I really hate is that you can't document it at all, except in plain text. Documenting it helps r your editor to catch possible errors, make suggestions, infer the type of something. Even PHPDoc, which could easily implement things like documentation for enums, generics and function signatures doesn't. Apparently, because JavaDoc — which is what they blatantly copied — doesn't have that either? But that is because Java has those features built in...

I think the best I can say about PHP is that it's a worse Java, but at least you don't have to explicitly give types to everything and you don't have to recompile everything after every change (though I believe frameworks like Spring have features that also do this). It's also extremely simple to host.

TL:DR; I can deal with it.

Can someone tell a PHP newfag what's so bad about it? It's my first backend language so I have nothing to compare it against, so far it's pretty comfy

Read "PHP: a fractal of bad design"

bump

There is nothing fucking comfy about PHP.

I'd take node.js over that shit. Look in to Django or Go.

Trendfaggots don't want to admit all the questions have already been answered and make up pretend goalposts like how popular php frameworks are "bloated" and make the site go 2% slower when they don't use 99% of its features and compare it to something else barely capable of a hello world.

Nobody cares about dropout langs because they don't let you produce. Get a $100 a month VPS, any php framework, you can immediately make web apps and make money. Snowflakes think that by offhandedly mentioning obscure bullshit that php doesn't have (because it isn't an autistic 80s dropout lang) this makes them hireable or somehow immediately generate magic donation money.

Node is a meme. If you know what you're doing in modern PHP, it's really comfy

actual web developer here, I agree. php sucks and is too archaic to use for every day use. javascrip is the future.

Using PHP for final capstone project. It's more usable now than what I remembered, but it still has quirks that I don't like.

>Get a $100 a month VPS
>$100 a fucking month for basic web dev

He is talking about AWS, because all the kewl kids are using it.

>hating on the most widely used language
You're one of them hipsters aren't you

>popular php frameworks are "bloated" and make the site go 2% slower
No, the ones that hide PHP's warts the best, like Laravel and Symphony, are considerably slower. See pic. Not that it will be a big deal for most deployments, but let's not mislead the newfag.
>Nobody cares about dropout langs because they don't let you produce.
I am not sure what you consider "dropout langs", but languages other than PHP have web frameworks that let you be as productive as in PHP without having to deal with PHP's legacy of bad design decisions.
>Get a $100 a month VPS, any php framework, you can immediately make web apps and make money.
Get a $5/month VPS, Django/Rails, and you can immediately make web apps and make money.
>obscure bullshit that php doesn't have
The problem with PHP isn't the obscure bullshit it doesn't have, it's the obscure bullshit it has far too much of.

>uncritically liking things because they are popular

>php sucks meme
>its popular therefore it sucks
kek

PHP is a polarising language because it was never architected, it was grown piecemeal by adding features that people wanted to solve problems they were having. This means you have to deal with inconsistent parameter ordering due to inheriting C library interfaces verbatim, C/C++-like syntax that behaves strangely because of dynamic typing and lack of pointers, which then have several particular methods that work around that lack that you have to learn their individual strengths and quirks. Most people get tripped up by the way it compares values because of the lack of static typing, and get even more angry when it's pointed out that there are additional language constructs that "fix" that for varying definitions of fix.

The elephant in the room is that while PHP is ugly, inconsistent and frequently frustrating in a way that a well architected language isn't, it GETS STUFF DONE. PHP is like C in that there's a reason so many major projects are written in it and not in "better" languages. Because those better languages put up roadblocks and asking for solutions to the problems regularly lands you in the company of snooty purists who suggest that you brought it on yourself and you need to re-architect your program to suit the one-true-way(tm) of node.js/ruby/functional-du-jour purism. Where PHP is the old cart horse that just does what's needed for an easy life. Although it must be said, like C, it's a loaded shotgun aimed at your face and you need to be well aware of its quirks lest you accidentally pull the trigger.

>be me
>want to make a web site
>learn php
>learn laravel
>laravel comes with all you need
>full login/registration system
>bootstrap
>no need to worry about xss and sql injections
>braindead easy crud
>braindead easy orm
>don't even need to use 70% of what I learned about php
FUCK THIS SHIT WAS TOO EASY I WANT MY LANGUAGE TO BE COMPLICATED SO I CAN BOAST ABOUT HOW MUCH OF A REEL PROGRAMMER I AM ON A REEL PROGRAMMING LANGUAGE. FUCK PHP !!!

Way to reinforce the stereotype of the defensive and insecure PHP programmer. Laravel is a Rails clone anyway, so what you're praising is the design behind Rails, not PHP.

For school i've only ever used php for web dev projects. Would it be better to learn something like ruby or .net for the real world?

php would be tolerable without the fucking $ and ->

PHP's speeds have gotten better since 7.0. If you go with a framework like Laravel you'll be comfy. I'll probably try using .net core for my next project.

Be careful about calling PHP shit, OP. I

>Laravel is a Rails clone anyway
Way to reinforce the stereotype of the defensive and insecure Ruby programmer.

1.Even if it was true , how does that change anything ? Pro tip: you can't do anything about it.
2.I'm not into web dev anymore but if I need a web app I'd go for the following criteria:
A.Free or cheap hosting with everything set up
B.Popular
C.Faster than Python
Guess which one Ruby gets the mark on ? Pro tip: none.

There is no such thing as "the best web language to learn" , you use different stuff for different things. Like java/asp for enterprise stuff , rails if you like dying communities , django/flask if you like python , etc

I'm too much of a brainlet for OOP so vanilla PHP is perfect for me. I don't even understand what those stuff that PHP lacks means.

PHP might be a shit language for brainlets but Im glad there's one for IQlets like me.

When I want to implement a feature for a project I can just google how to do it and there will instructions on StackOverflow. Reading documentation is too hard on my dyslexia.

...

>the design behind rails
Rails didn't invent MVC architecture

>Way to reinforce the stereotype of the defensive and insecure Ruby programmer.
Weak comeback. I called you defensive and insecure for your at length screeching in all caps about how you think others do not use PHP in order to feel like real programmers. You call me defensive and insecure... for pointing out where Laravel's design came from?
>1.Even if it was true , how does that change anything ?
It is true. The short version is that ASP.NET MVC copied (or "was inspired by") Rails and Laravel copied ASP.NET MVC. What it changes is that the shit you were praising as easy isn't easy thanks to PHP. Therefore, you can get the easy shit elsewhere without the other, shitty, PHP shit.
>Pro tip: you can't do anything about it.
Seems like you were trying to get clever and imply something insulting to me here.
>2.I'm not into web dev anymore but if I need a web app I'd go for the following criteria:
>A.Free or cheap hosting with everything set up
Free hosting sucks. A decent VPS can be had for $3-$10 per month.
>B.Popular
Rails, Django, etc. are popular. They are less popular than PHP itself, but comparable to Laravel and other frameworks that make PHP tolerable.

I am not trying to promote Ruby/Rails, by the way. I am trying to dispel the myth that PHP is easy. Raw PHP is easy and fast, but sucks too much to use for anything serious. PHP with a real MVC framework is no easier and hardly faster than a decent language with the same kind of framework, be it Python/Django or C# and ASP.NET Core.
>C.Faster than Python
Seems pretty arbitrary. Why Python in particular? Ruby 2.0 and later is generally faster than CPython on computational workloads, but it doesn't matter because both are dog slow. Again, I am not pushing Ruby here. Pick C# or another thoughtfully designed fast language with a Web development community. What does performance matter to you if you want to use free/shared hosting, though?

It isn't just MVC. The specific brand of MVC combined with an Active Record pattern ORM, a certain kind of tooling, etc. was popularized by Rails and then widely copied.

Welp, there you go again

Not all php code is bad. Take a look at gitgud.io/chiru.no/chiru.no

This.

PHP isn't pretty, but it solves everyone's problems, because that's what it's been doing since its inception.

Sorry. But that's as nice as I can be to the language.

If you use a shitton of abstraction layers that bring your requests/s down to a crawl, the language becomes somewhat tolerable.

Django is not a language, moron

I think that user suggests not that Django is a language but that Go is its own web framework.

i don't care about PHP enough to hate on it

Can I be your friend? Any tips for a fellow brainlet? I somehow need this to work so I can a fair job even if I'm hardly good at it

Ask /wdg/.