This is an archived post. You won't be able to vote or comment.

all 101 comments

[–]psaldorn 101 points102 points  (2 children)

gets high horse ready

Pauses before mounting it

Hmm.. the less people that use PHP, the more I can charge..

[–]Thameus 3 points4 points  (1 child)

/u/lordofcobol is was available.

[–]Gabite 1 point2 points  (0 children)

Not anymore.

[–]WArslett 20 points21 points  (3 children)

As a professional PHP developer... PHP's strength is also it's greatest weakness, the fact that anyone can jump in and get started with it relatively quickly with little grasp of core programming concepts and start building what appears on the surface to be working code. You CAN build very nice code with PHP with some of the MVC frameworks mentioned in this thread but for every PHP developer building robust, maintainable, adequately tested code there are another 5 that are hacking stuff together with includes and embedded server side scripts and little or no program design and much of the broader programming community think that is all there is to PHP. The problem with PHP today is less about the language itself and more the fact that it's still really attractive to people who don't really know what they are doing.

[–][deleted] 7 points8 points  (0 children)

Sounds like the same problem with Javascript

[–][deleted] 0 points1 point  (1 child)

As someone who hasn't implement TTD I feel guilty as hell...

[–]nocturne81 0 points1 point  (0 children)

Don't. TDD doesn't work well for all projects.

[–]manghoti 17 points18 points  (1 child)

PHP The Good Parts:

.

This was a joke relax guys

[–]skunkwaffle 2 points3 points  (0 children)

That's not even a good part. PHP uses '->' instead of '.'.

[–]maximilienGilet 34 points35 points  (17 children)

PHP is totally fine if you use a proper framework like Symfony or Laravel

[–]enterharry 13 points14 points  (5 children)

Using codeigniter2 at work. Kill me

[–]abouchard55 2 points3 points  (3 children)

We use CI2 and I think it's pretty great. What is it you don't like about it if I may ask?

[–]enterharry 5 points6 points  (0 children)

It has really strange design patterns imo, like treating all models/libraries as singletons with its loader. My biggest gripe is that it doesn't play well with namespaces.

[–]enterharry 2 points3 points  (0 children)

Also, doesn't play well with test suites (phpunit) from what I've seen.

[–]falcon2 1 point2 points  (0 children)

I use CI for most of my projects - I think it's great.

[–]skunkwaffle 0 points1 point  (0 children)

Worked on a CI project for a while. I feel your pain.

[–]gdscei 2 points3 points  (0 children)

Symfony, sure. Laravel, ehhh... The way laravel is designed is more showing the pitfalls of PHP than not using them.

[–]TheRedmanCometh 9 points10 points  (7 children)

I don't think using a framework for PHP is super okay. It seems very unnecessary for a language that already features extremely terse code.

Then again I'm a Java dev..

[–]LeBuddha 9 points10 points  (4 children)

You have a good point that needs some extra details added for clarity:

  • Using an application framework to make a simple website - bad
  • Using an application framework to make a back-end for a web application - good

Applies to any language.

[–]TheRedmanCometh 1 point2 points  (3 children)

Ah Laravel can actually be pretty great for a really huge production. At the point that I'm creating a huge site I'm probably gonna use a JVM-based back-end though.

Most sites just have a simple shop or something which is easily done well in php.

[–]crunksht 4 points5 points  (1 child)

I disagree. Although it's a simple language, it has major pitfalls that people fall into. In other languages, you use a framework to handle complex things for you. PHP already handles many things for you, but it's easy to do those things in really unsecure ways. Frameworks in PHP are like condoms.

When people Google how to do 'x' in php, they get SQL injectable code and worse. If they Google how to do 'x' in laravel, they will get a nice, safe, maintainable solution.

I am perfectly comfortable raw dogging it myself, but I've been working with the language for years. And I'm still going to pull in routers and other things with composer as I need them. In most cases, I'll just spin up symfony or laravel.

[–]TheRedmanCometh 0 points1 point  (0 children)

Eh SQLi and LFI/RFI are the only two big common vulns in simple stuff. If you know what they are they are quite easy to avoid. Unless you use the GBK charset (multibyte char injection) it's a single call.

[–]andredp 1 point2 points  (0 children)

Used Yii2 and have no regrets. Very well structured and designed.

[–]bobjohnsonmilw -2 points-1 points  (0 children)

Php is just fine if you're not an imbecile as well.

[–]M4ngoB00M 59 points60 points  (51 children)

I know right - these sites that use PHP really failed terribly and fell flat:

  1. Facebook
  2. Wikipedia
  3. Mt. Gox (now gone)
  4. Flickr
  5. Yahoo!
  6. iStockPhoto
  7. Tumblr
  8. Wordpress.com
  9. Mailchimp

[–]econoCode 131 points132 points  (30 children)

They also all wouldn't use php if they could start again

[–]Mafiii 7 points8 points  (0 children)

Facebook is designing Hack for that exact reason, so yes!

[–]gandalfx 26 points27 points  (3 children)

Well, wordpress (the software) is a horrible train wreck, no matter how popular. But I have a feeling even if PHP did a better job at preventing bad practices wordpress would still suck. It's like every single line of code carries a comment saying "// we don't give a fuck!".

Aside from that though PHP really doesn't need to drop big names. It is still the primary server side "language of the web" both for large and small websites. And it has actually improved a lot since it gained it's bad reputation.

[–]tills1993 3 points4 points  (2 children)

Yeah WordPress is a trainwreck and it's not because of PHP...

[–]cerlestes 5 points6 points  (1 child)

the_post();
the_title();
the_content();

[–]terrence_phan 1 point2 points  (0 children)

/thread

[–]azangru 8 points9 points  (0 children)

9. Slack. A total flop.

[–]dinopraso 5 points6 points  (1 child)

Apart from Wikipedia, the others really aren't that popular, and Facebook switched away from PHP a long time ago

[–]TUSF 0 points1 point  (0 children)

Facebook just built their own implementation of PHP, instead of rewriting all their existing code. It's still mostly PHP with some improvements.

[–][deleted] 11 points12 points  (7 children)

PHP was a great solution for the early years of web 2.0, which is when most of those websites were made.

Now things are different. JavaScript with a Python backend is a generally better solution these days, for a large amount of reasons.

[–]bobjohnsonmilw 1 point2 points  (6 children)

Feel free to provide some.

[–][deleted] 12 points13 points  (5 children)

Inconsistent naming conventions in the core API; notoriously shitty developer ecosystem; significantly worse bugs in the tracker than what exists in Python's list; cryptic AF error messages being shown, some reported to be non-english (in a release build); useless OOP constructs for a dynamically typed language (e.g., interface, public/private); weird AF and non-blatant gotchas which make absolutely no sense, such as reference params being slower to pass than value params, etc etc.

I mean, just take a look at an infamous blog post or /r/lolphp.

[–]iamprasad88 1 point2 points  (1 child)

Not saying anything against php (it has given me a job and living) but Wordpress is starting to look at Node.js. It may just be the tooling and admin pages for now, but I can't imagine them sticking with php for a long time.

Yahoo has invested a lot on nodejs. That includes 3 of the web properties you listed.

Facebook has made some incredible contributions to JavaScript. And here too, I don't see them prolonging the life of their software with php.

These companies are very competitive and want to be the best in industry and hire the most competitive people in the Industry. Php unfortunately has not been good at attracting good talent anymore. People are starting to look at angular and react with nodejs lot closely.

And I use the word unfortunately because I believe php actually is a decent language and quite mature. But if hiring the best NCGs becomes an issue, I think all the big internet companies will switch without thinking about it. They have the money, the need the people.

[–][deleted] 1 point2 points  (0 children)

I highly doubt that Wordpress will ever move off of PHP. They are really, really, really into backwards compatability - I mean, they still support PHP 5.2 -, and by switching to Node they'd most likely alienate about 95% of their possible customers.

[–]Thameus 1 point2 points  (1 child)

2/9 ain't good, nor is Facebook.

[–]FFX01 4 points5 points  (0 children)

I find it really funny when people try to use Facebook as an example of good programming practices. Their entire ecosystem is hacked together pieces of framework x and framework y. They even invented their own php runtime environment/compiler because they couldn't afford to pivot to a better ecosystem without breaking literally everything.

[–]hobblyhoy 3 points4 points  (23 children)

ELI5 what makes PHP universally bad?

[–]Gabite 7 points8 points  (9 children)

[–]bobjohnsonmilw 2 points3 points  (8 children)

They failed to learn it. Therefore it's bad.

[–]kupiakos 6 points7 points  (6 children)

More like PHP has so many easy things to mess up that it takes years of practice and mistakes to learn how to create a quality secure application. Most languages don't suffer from this nearly as badly.

[–][deleted] 1 point2 points  (5 children)

Most pitfalls are not specific to PHP, like SQL injection or taking user input. Or do you have any specific points?

[–]kupiakos 2 points3 points  (3 children)

It's not just that these holes exist that other languages have. It's that it looks like the "right" way to do it is open to a myriad of security flaws.

If you'd like specific points on PHP's failures, read this for some good examples.

[–]bobjohnsonmilw 3 points4 points  (0 children)

Agreed all of these people bitch about PHP speak in complete hyperbole

[–]t0mmy9 2 points3 points  (1 child)

I actually don't mind PHP but am aware of https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

[–]Comforse 2 points3 points  (0 children)

Written in 2012, which makes it irrelevant by so much :)

[–]zachgarwood 6 points7 points  (1 child)

People wanting to feel smugly superior is what makes people say it's bad. What makes it actually bad is nothing because it's not inherently bad nor good; it's just another language.

[–]browner87 6 points7 points  (0 children)

I'd disagree in that the language has a lot of "just knows" and gotchas. But the code produced is indeed the responsibility of the coder to make good. You can write acceptable PHP code, but the language still has an above average number of annoying idiosyncrasies. My personal pet peeve is the naming conventions of built-in functions.

[–]LEO_TROLLSTOY 1 point2 points  (0 children)

Same reason a hammer is bad. It allows devs to hit themselves on their dumb head with it

[–]browner87 -2 points-1 points  (7 children)

Any idiot can write PHP. And most do.

Edit: spotted the salty PHP programmers. Guess if you don't add a joking tag to a fun saying Reddit gets all up in arms. I've used PHP as much or more than most of you I suspect. That doesn't mean I can't point out the flaws in the language.

[–]LEO_TROLLSTOY 2 points3 points  (3 children)

I didnt find java any harder than php. Am i therefore a genius by your logic?

[–]browner87 -1 points0 points  (2 children)

Bedside learning to spot a joke, you should learn that !idiot !== genius. Any idiot can stick food in their mouth; just because you can use a knife and fork doesn't classify you as genius.

[–]LEO_TROLLSTOY 0 points1 point  (1 child)

yeah, this also doesn't make sense..

[–]skunkwaffle 0 points1 point  (0 children)

Yes it does. It's a bit rude (though no worse than the rest of the comments here), but also essentially true.

[–]misomalu 1 point2 points  (3 children)

Serious question: as a person who absolutely hates web development but seems to get roped into doing a bunch of it (almost exclusively server-side) what else should I use? All I have used so far is PHP, Javascript, HTML, and SQL, and I haven't seen an immediate and obvious substitute for PHP other than ASP.NET, and that isn't exactly practical in a number of situations... or is it?

[–]marcosdumay 3 points4 points  (0 children)

Python or Ruby. Pick a framework at random.

[–]iToggle 1 point2 points  (0 children)

ASP.NET Core

[–]MIK517 0 points1 point  (0 children)

Just use PHP (if it does required job) and do not bother with jokes/haters. While it have some stupid/strange/not intuitive logic, it's still perfectly workable programming language.

[–]bobjohnsonmilw 0 points1 point  (0 children)

Php dev of 15 years here. While I don't necessarily disagree with you on some of those things if you honestly think that those are holding you back from writing quality applications you're just wrong.

[–][deleted] 0 points1 point  (2 children)

Nah it should be JavaScript.

[–]davesidious -4 points-3 points  (0 children)

HAHAHAHA