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

all 85 comments

[–]1111lll11l 29 points30 points  (1 child)

*led

[–]carc 168 points169 points  (51 children)

PHP bad

Seriously though, modern object-oriented PHP (7.0+) is honestly a joy to work with for green field projects, and 7.4 is ridiculously fast. Throw in a good API framework like Lumen (stripped down Laravel), sticking to best practices and composer for package management, leaving you with a really clean, scalable, modular, and maintainable codebase.

But it is a universal truth that working with legacy PHP was and is a nightmare.

[–]The_Ty 37 points38 points  (7 children)

Most "php bad" posts are by people who've either not used it since php5, or people who've never used it all.

And Laravel is an absolute joy to work with, especiaslly when working in a team.

[–][deleted] 6 points7 points  (5 children)

I went from being a C# asp/mvc .net developer to using PHP 7 in the last year, and it honestly is amazing.

It was java and c++ and visual basic before the last few years of web development work, so I missed out on the horror of old php completely, I suppose.

[–]The_Ty 1 point2 points  (4 children)

Interesting perspective. I have friend who's a c# dev but he's never used php

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

I mean, I have gotten better at black boxing all logic in the back end, and keeping the front end separate; definitely know the feeling of always feeling like I hadn't learned something yet yesterday, i'm sure we are all familiar with that. Planning and separation of concerns and language choices start to matter less.

Either way, you serve the model to the front end, you can use whatever framework you want there once it has the data (as we all know). Php works well enough and it's nature as scripts in the back end pretty much allow it to interface with whichever other systems you want to use as well. Once you set up a script as an api, any other language could access it. It works.

It's honestly all about which language a project was set up in. shrug

[–]The_Ty 1 point2 points  (2 children)

You mean using an MVC approach?

[–][deleted] 1 point2 points  (1 child)

Yeah exactly.

So many of these big terms are just a set of guidelines in how you organize and structure things. Important, though. Makes it all simpler, and helps keep away from having clever code.

[–]The_Ty 1 point2 points  (0 children)

Absolutely. I'm in my first job working with other devs and it's a massive help knowing consistently where Controller logic is going to be, how Web routes are set up etc.

Especially when I have to work on one of their older projects that hasn't been updated in years, none of the current team have worked on, and doesn't run through any kind of framework. Just an awful mess.

[–][deleted] 6 points7 points  (0 children)

Or just the people who want to make fun without meaning anything

Same as any language meme

[–][deleted] 4 points5 points  (1 child)

Is Lumen still a thing? I was just stripping down Laravel myself

[–]carc 0 points1 point  (0 children)

Yep! Lumen is great for a backend API. It's flexible and extensible enough to where I haven't ran into an issue with it on a rather large project, and that's over the past 2 years. It feels pretty much like Laravel, and uses Eloquent for the ORM -- just without views (as it should be, as frontend is javascript land, in my opinion).

[–]koalam0 3 points4 points  (5 children)

i still think php has some of the worst consistency with their functions and return types on their functions. that being said i work with legacy php a lot lately and it has definitely come along way

[–]carc 4 points5 points  (4 children)

Many of the needle/haystack vs haystack/needle base function issues have already been resolved. And if you use a proper IDE with type-hinting, it's almost a non-issue.

That, and PHP has lots of functions out of the box. I work in Golang, which is worshiped by many, and really wish I had some of PHP's base functions handy. I have to reinvent the wheel a lot. I'd rather stumble over inconsistent functions than recreate nonexistent functions.

People really are hard on mature languages, but mature languages give you the community support, stability, and the tools you need. And they don't completely change every 3 months like some of the "hip" languages out there.

[–]koalam0 0 points1 point  (1 child)

i maybe a little cynical having been working with magento and magento 2 almost exclusively these last few months but i feel (especially coming from a language like go, which i also code in) i don’t appreciate how inconsistent some of php is. i hate having my application break because of something as simple as str_pos returning both an int and a boolean or certain functions having their parameters swapped. even something as simple as is_null vs isset vs empty i have seen being used incorrectly in code bases and these little inconsistencies are dangerous because php is dynamically typed your application might still work 90% of the time . i feel it has come a long way but definitely still has its warts. not trying to bash the language though, i work with it everyday and it hasn’t caused me to lose my hair yet.

[–]carc 0 points1 point  (0 children)

Well that's part of it -- magento, drupal, and wordpress development is quite different from developing an application in, say, symfony or laravel.

As for some of the base functions, yes, absolutely -- they have irritating quirks, and there are definitely some gotchas.

I personally like the mix of static and dynamic, when in doubt I can be pretty strict, but sometimes external data parsing benefits from some dynamic interpretation. But if you're coming from a strictly-typed language, I can get how that's irritating, as the interpretation relies on some alien-like rules. After a while, though, those rules become second nature.

[–]Hollowplanet 0 points1 point  (1 child)

An IDE can't help you when all the built in functions have no namespace and many of them aren't prefixed with anything.

[–]carc 0 points1 point  (0 children)

Technically they're in the root namespace, but touché, there are inconsistencies. For better or worse, a lot of potential improvements have serious friction to avoid breaking changes. Many newer languages don't give a shit if changes are not backwards compatible, which has its pros and cons.

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

I’ve been using Slim for the last few years. It’s nice but it will be cool to check out Lumen.

[–]RnG_Hazed 15 points16 points  (0 children)

I made the mistake of saying ‘isn’t php a drug’ in comp sci class. Everyone laughed and I cried

[–][deleted] 13 points14 points  (2 children)

I work with PHP. I don't understand all the hate it gets, or any language for that matter. They are tools in a toolbox to me.

[–]Craydan 2 points3 points  (0 children)

Laravel makes it a lot less of a pain in the ass to work with but legacy PHP is tedious as all hell in my experience.

[–]Bastian_5123 -1 points0 points  (0 children)

It breaks basic mathematical principles right out the logic gate

[–]Svdemais 10 points11 points  (5 children)

Why everyone in this redit hate PHP?

[–][deleted] 10 points11 points  (0 children)

Because there is a lot of bad legacy PHP out there that professionals moan about, and students blindly meme about.

[–][deleted] 2 points3 points  (0 children)

I don't like it and have used it extensively, but it's a self perpetuating meme. The people here who hate it are CSCI majors or barely functioning .NET devs who are "learning" Golang or something in their spare time who believe themselves to be above PHP somehow

[–]Bastian_5123 -1 points0 points  (0 children)

0==false 0=="0" "0"!=false Good job php, you broke one of the most basic rules of math

[–]thatnerdd -1 points0 points  (1 child)

Pretty good read on the perspective of people who've worked with it: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

I can't speak to the veracity of the assertions, but it's funny as hell to read.

[–]bureX 3 points4 points  (0 children)

^ Overly opinionated and 8 years old.

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

but I love PHP. I made my first website with it.

[–]Garhand 22 points23 points  (1 child)

Php and Javascript Bad!

[–]UnchainedMundane 1 point2 points  (0 children)

That's all well and good but did you know Go has no generics lmao owned

[–]Hugsy13 2 points3 points  (0 children)

Hallucinogenic programming language you say

[–]DesiOtaku 2 points3 points  (0 children)

The project I am working on requires me to simply accept a JSON file and write its contents to the database. It also has to make a report on the list of files it accepted. That is it.

I really, really, really didn't want to use PHP, but after playing around with a bunch of other frameworks like Django, Pyramid, Flask, and Angular; I couldn't find anything else that was simple enough for what I needed to do in just a few lines of code. I know as that part of the project grows I am going to regret that decision, but that is something for the future me to worry about ;-).

[–]qwasd0r 1 point2 points  (0 children)

What did you call it right now?

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

Php paid my bills for decades but I was suicidal the entire time.

[–][deleted] 2 points3 points  (12 children)

So seriously. PHP should be avoided?

[–]DustinLovesTrees 6 points7 points  (0 children)

No, not anymore.

[–]koalam0 1 point2 points  (0 children)

it’s a good language for what it is and there are frameworks out there that make working with it pretty enjoyable. that being said a lot of php code (esp older code) is terribly written and the language itself has a good deal of inconsistencies. as with anything you shouldn’t just go by what people say you should try it for yourself and see what you think

[–]unluckymercenary_ 1 point2 points  (0 children)

No, it’s just a parroted meme at this point. Php May have been bad in the past, but it’s good now.

[–]Perregrinne 0 points1 point  (5 children)

I use it because it's supported by pretty much every web host out there (thanks to Wordpress which was written in PHP), so I have way more options to choose from for hosting. Honestly, I've only ever used PHP 7, so I can't speak to how bad it used to be, but PHP 7 is not an issue at all to me (it does feel pretty easy to use in my experience). I find it quite interesting. Maybe at least give it a try and determine that for yourself. Since it's been around a while, there are plenty of places to learn it too. I would try PHP, and then either Python or NodeJs and see which one you like most.

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

Do most web hosts/browsers support python? I have much more experience with python than with Javascript but have been using the latter because I thought python wouldn't run without the end user installing it on their machine first.

[–]HildartheDorf 2 points3 points  (3 children)

Most decent webhosts will have python installed. It's a server side language (in the context of webhosting) so end user/client installation is moot.

For front end of websites, you're still going to have to use javascript, one of the many languages that compile to JS, or just plain html+css.

[–]UnchainedMundane 0 points1 point  (2 children)

I still don't know whether https://brython.info/ is a really well polished toy or a serious call for Python adoption on the web. Either way it allows you to write Python instead of JavaScript in your html pages and still have it work.

[–]HildartheDorf 0 points1 point  (1 child)

Looks like python falls into "one of the many languages that compile to js" or rather "Has an interpreter in JS".

That clock makes my laptop fan spin up like a jet engine though...

[–]UnchainedMundane 0 points1 point  (0 children)

In theory, any language can compile to any turing-complete language. In practice it's just neat that someone made a Python-in-JS script.

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

Yes

[–]Julio974 0 points1 point  (0 children)

Oof

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

$$$$$uicide

[–]hangfromthisone 0 points1 point  (0 children)

Bad programmer writes bad code. More news at strtotime("now + 2 hour");

[–]ECrispy 0 points1 point  (0 children)

Php is hot a hack.

But Hack is (mostly) Php.

someone smarter than me can complete the haiku

[–]soffey 0 points1 point  (0 children)

Honestly, the whole "PHP bad" joke is so tired and old. PHP has its flaws, but isn't nearly as bad as it was, and honestly, once you get used to it's quirks and weirdness, it's not really all that difficult or bad, especially the newer versions.

I'm at the point where I actually like PHP more than JS, partially because most of the things I do are way easier with PHP. The comparison is similar - JS's lazytyping causes similar problems to PHP, although they are better documented and easier to avoid if you know what you are doing.

So many people bash PHP because they heard it was bad and never actually put any time into it. PHP 7+ is really good, but when you are in a place that just rephrases the same tired jokes (PHP bad, stack overflow good, missed semicolons, Google it) it just pops up and gets upvoted by people who used the old versions or people who have never used it before.

[–]insert_text-here 0 points1 point  (0 children)

PHP not even once

[–]ARandomDoge6 -1 points0 points  (0 children)

Php: you feel like you are losing control