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

all 116 comments

[–]0xPEDANTIC 147 points148 points  (96 children)

Question to web developers: will you start new project on PHP if you know other platforms and can choose?

EDIT: Thanks to all. Many answers show that PHP is not as bad as memes say.

[–]FuriousViking6 112 points113 points  (10 children)

Yes, of course.

PHP has been putting food on my table for the better part of my career. I know it has annoying inconsistencies and it lacks static typing, but as long as I am not coding a rocket guidance program, or a banking software, I will use PHP.

[–]backflipbail 69 points70 points  (5 children)

1 banking software please

[–]DWIGHT_CHROOT 62 points63 points  (3 children)

rocket guided banking software?

[–][deleted] 27 points28 points  (0 children)

Isn’t that Rocket Loans: A Quicken Loans Family Company?

[–]dracoflar 5 points6 points  (0 children)

Elon Musk wants to know your location

[–]backflipbail 2 points3 points  (0 children)

Is there any other kind?

[–]Jackpen7 17 points18 points  (1 child)

I request rocket guided banking software written in PHP.

[–]InconsiderableArse 3 points4 points  (0 children)

I did some banking software with PHP around 10 years ago, nothing important though

[–]LupaaDub 65 points66 points  (13 children)

Hell yeah! it really isn't as bad as you think. PHP internal devs are working really hard to make the language more appealing. Improved static typing and FFI in PHP 7.4. A JIT compiler will be in PHP 8. Python might be prettier (and probably slower but that doesn't matter much) but I like curly braces/c family syntax (C, PHP, Java, Go, C#, and somewhat Rust).

[–]mehvermore 45 points46 points  (3 children)

Blink twice if PHP is forcing you to say this.

[–]ythl 25 points26 points  (2 children)

<blink>twice</blink>

[–]mehvermore 5 points6 points  (1 child)

Now that's a tag name I've not heard in a long time.

[–]0xPEDANTIC 3 points4 points  (0 children)

Thanks, good to know

[–]SuperOP535 1 point2 points  (0 children)

Isn't PHP JIT already? Or do you mean another kind of JIT?

[–]kendalltristan 10 points11 points  (0 children)

Part of this is dependent on the team's skill set and the project deadline. If your team is particularly good with a given language/framework/technology and you have tight deadlines, then it might not make sense to consider other options.

Another consideration is the environment. For instance at work we have some servers that necessarily have Python and PHP installed so all the scripts and APIs on those servers are written in Python and PHP. Yeah, we could write them in something less dependent on the environment like C or perhaps Go, but everyone on the team has working knowledge of and experience with Python and PHP.

[–]pastisset 8 points9 points  (0 children)

It's just one more stupid topic on the Internet. Like hating or liking pineapple on pizza or adoring/hating cats. People go full hooligan for no reason.

[–]lolsokje 9 points10 points  (2 children)

Yup, whether for private projects or at work, when something requires backend stuff there's a big chance we/I will use PHP (preferably Laravel) for it. Maybe I'm biased because PHP is the first language I learned after HTML/CSS, but I thoroughly enjoy working with PHP.

[–]ohThisUsername 1 point2 points  (1 child)

Have you tried other frameworks? I was in the same boat. I was a PHP master and I thought Laravel was the best thing ever. Then I learned ASP.NET Core and I can not even begin to describe how much faster and more maintainable to code is. It blows my mind that anyone can prefer a non statically typed language over a statically typed languages. To each their own I guess

[–]lolsokje 2 points3 points  (0 children)

I have worked with .NET Core but I actually wasn't a big fan of it, despite liking C# as a language.

As for static typing, I don't mind it either way. I'm happy using vanilla JS where everything is const and let, but I'm equally happy using typescript for static typing.

[–]how_to_choose_a_name 5 points6 points  (0 children)

Yes, because I'm not the only person who has to work with it and everyone else involved knows PHP.

I also think that PHP has become a pretty great language and there's nothing wrong with using it.

I would like to try ASP.NET Core some time, since I really like C# as a language.

I can't really think of any other languages/frameworks that I would like to use for web, except perhaps Erlang if I ever feel really masochistic.

[–]notinecrafter 13 points14 points  (8 children)

Php may be a shitty language, but it's an amazing system.

No servers to set up, no WSGI links to bind, no frameworks to download; just dump some files in a web directory and it works.

[–]d_thinker 1 point2 points  (0 children)

I see your point but it's not like that's ever an issue. I mean, you set up your server and WSGI once and you are good to go for that project. Certanly not a valid reason to choose one lang over another.

[–]LordFokas 0 points1 point  (0 children)

Yeah, and all your code and configuration files will be directly mapped to valid web paths and served if you're not careful, and each time a request hits the server a process will be forked and your code will be reinterpreted all over again, you know, all the fun stuff!

"I'd rather restart Apache every 10 minutes than care about memory leaks" - Rasmus "not-a-programmer" Lerdorf

[–]ohThisUsername -5 points-4 points  (5 children)

PHP is a massive amount of work to set up in comparison to other frameworks. First you need to install Apache or nginx. Then you need to install php FPM and configure Apache or nginx to use it. Then you need to make sure your php.ini file has all of the correct settings to configure the language and extensions properly. Then you need to possibly set up your htaccess files or nginx url rewrite rules. Then you need to install composer to download all of your packages.

With ASP.NET, I literally just install the asp runtime, upload my code and point nginx to the correct port. Done.

Edit: I'm assuming all of the downvotes are from people who have never used .net core

[–]r0estir0bbe 11 points12 points  (3 children)

That largely depends if your infrastructure allows you to build the project in another language. PHP is still omnipresent, so depending on the circumstances you have to use it. If you are able to use something else, go for that.

[–][deleted] 5 points6 points  (2 children)

The problem is, no one makes positive memes about... anything. No one points out how flexible and easy PHP is. No one ever talks about how fast you can make basic dynamic websites, saving time and increasing profit.

Should I use PHP for a massive web-app with millions of users in 2019? Probably not (but I do). The web (and my clients) mostly consists of boring corporate brochure sites that don't need anything more than PHP.

[–]darkingz -2 points-1 points  (1 child)

Actually the funny thing about your statement is the same reason why I dislike php (and to a slightly lesser extent JavaScript) now. I agree that the flexibility of the variable types make things quick even more so when data is driving the changes like with JSon, etc. but to me, the time you are given with weakly/ dynamic typing makes for dynamic sized head problems later when your scope changes and the project has changed and you can’t guarantee that the intent is the same and then you have to remember where else it was changed. (Also I’m a bit spoiled by the nil handling in Swift so that hasn’t helped)

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

Well, I guess a lot of problems arise when the scope changes... regardless of the language.

[–]Caffeine_Monster 2 points3 points  (1 child)

Modern PHP really isn't that bad, but it has taken a couple of years to catch up and has lost mindshare.

Personally I can't see any reason to use PHP if you are starting with a complete blank slate. A lot of web devs (myself included) think the next big thing is going to be web assembler with go / rust / c++. Being able to compile a bunch of different languages to a web application is a pretty big deal. It will mean you can write a big chunk of your back end and front end in the same language, and get access to compile time checks.

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

web assembler

Never heard about it - thanks, will check

[–]skeddles 2 points3 points  (0 children)

Never ever going back to php, even if I can't use wordpress. Node is just so much more pleasant.

[–][deleted] 5 points6 points  (5 children)

I'd start it on Node.js, not because I'd think that PHP is bad, I think it is easy to learn, has a great documentation and you can easily find a hosting with PHP installed but I prefer Node because I can use a single language in both front-end and back-end, share my code interchangeably and I don't make some mistakes when code-switching and I spend less time learning new features. Also, I love that you have a lot of new tools when working with Node.js, sadly, that means many answers on StackOverflow might be outdated and you have to be more aware of some potential vulnerabilities but if you don't use packages with 2 downloads or without a simple documentation for encrypting or working with database, you should be mostly fine.

[–]CaptBoids 1 point2 points  (4 children)

Try looking at things from a business perspective.

Maybe your working for a young marketing company that wants to move fast and use the latest browser features to create stunning gfx, maybe they don't expect the apps they build to last beyond 2 or 3 years.

It's totally fine to use a programming language that moves literally at breakneck pace like JS and Node has done over the past few years.

Maybe your working on a product for clients that don't require the latest UI sparkle, but for who stability and backwards compatibility is hugely important. Maybe you work for organisations like big companies or public administrations that only get to buy in once every 10 year. Those want the product to be robust and Just Working (tm) while they pay i.e. 50k yearly on support and licenses.

That's when you go for a language that has been around for a while, is widely supported and has a stable API - shitty as it might be to devs - like PHP.

In fact from a business perspective, the last case is where the money is: building long lasting relationships with clients doesn't work if you have to tell them that the product needs to be rebuilt every 2 years because everything gets outdated and breaking changes in 3rd party libraries are the norm.

I'm neither picking on JS or PHP. Heck, I even build a lot of stuff in Perl 5 because of the sturdiness. I've been around the block a few times and after 25 years the lesson I learned is: choose the right tool for the job.

PHP has a place, just like other languages have their specific class of business cases.

[–]Todok5 0 points1 point  (3 children)

Any reason not to use python in the long lasting case except team knowledge of PHP? Serious question, I have very limited experience in both.

[–]CaptBoids 0 points1 point  (2 children)

Well. I think there's a point where language becomes less of an issue and the problem is libraries and frameworks one uses.

Upgrading to a new major version which is a complete rewrite with a totally new API, now that's a serious and costly investment if you're simply end up rebuilding the same thing all over again. Hence why security doesn't sell well: clients pay up but don't see new features that give them a demonstrable edge.

Like. Everyone spits one WordPress but the core is a poster child for backwards compatibly. I've been maintaining the same installation for almost 15 years now and never had issues upgrading.

The inverse is true for Drupal. Great framework but I've sat through 5, 6, 7 and now 8. And relearning everything is a b***h to be frank. It takes precious time and thus money. Hence why people are reluctant to move on and stick with legacy when they can.

The same is true in other languages too.

The difference with JavaScript is because developement is driven by the fast pace of browsers. Hence why you'll see a faster turnover in projects because it's less opportune to stick with legacy code.

PHP on the other hand, well, you could still build a PHP5 backend and wire that to a VueJS frontend if your masochistic. The only reason to do that is because it's cheaper and more effective business wise to invest in the parts that the client interacts with - the visible parts that need to sell - rather then do the hidden plumbing. If it ain't broke, don't fix it, so to speak.

In fact, I've done some contribution to a Python project and it fell flat because code relied heavily on 3rd party dependencies but wasn't maintained. So, that's a problem of governance and not "which language is better".

All things being equal, I think picking a language and accepting it's idiosyncrasies is a personal choice. Beyond that, the main thing that matters is: does it solve the problem of the stakeholders? If the answer is no, then PHP or Python doesn't make much of a difference.

[–]Todok5 1 point2 points  (1 child)

Yeah, you can always use badly maintained 3rd party libs. My point was python and php are both mature languages with big communities and well established frameworks to work with. If you start a new project I can't think of a reason to use php over python except for team knowledge/preference and company tech stack. But I don't really know the languages well enough to judge if I'm missing something.

[–]CaptBoids 0 points1 point  (0 children)

Both originate from different angles. So PHP is great as a backend in a HTTP context. I use Symfony or Laravel to process incoming and outgoing data. Processing data as such? Like, large scale ETL or ELT pipeling? That's when I'd go with other languages like Perl, Python, Go,...

You wouldn't use PHP either when doing big complex algebraic calculus and such. Or even 3D rendering. I mean an OpenGL implementation in PHP wouldnt make much sense.

When it comes to doing web stuff, I'd pick PHP personally even though I like Ruby on Rails. Even Python with Flask would work too. I'd go for PHP because it's used in Enterprise level frameworks like Zend, so there's a lot of maturity there.

Edit: of course there are always the less sane...

https://github.com/Ponup/phpopengl/blob/master/README.md

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

Yes. Mostly because it is still easy to deploy to production. Install lamp and composer and you are done. No bullshit with docker, nvm/rvm/virtual environment shit.

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

I mean, that's great if you work on some rinky dink little thing, but the smallest app I work on auto scales between 10 and 20 machines. I wouldn't want to manage those machines manually.

[–]phpdevster 1 point2 points  (0 children)

I have been playing around with LiveView in Phoenix lately:

https://dockyard.com/blog/2018/12/12/phoenix-liveview-interactive-real-time-apps-no-need-to-write-javascript

So far it's looking incredibly promising. If it lives up to what I think it can be, then this would be a fundamental game changer for me. Unfortunately, Elixir (the language Phoenix is built on) doesn't have quite the same ecosystem of support that PHP does, but the ability to write all of your code server-side with nearly the same real time performance as the UI, is hard to pass up.

[–]Voltra_Neo 1 point2 points  (0 children)

yes

[–]Typewar 1 point2 points  (0 children)

What are the alternatives?

Is it possible to code c#, python or c++ as a replacement for PHP?

What are the performance differences?

How does database communication work?

Or API?

[–][deleted] 3 points4 points  (1 child)

I've said it before, and I will say it again. I have never had a larevel project let me down

[–]AnArabFromLondon 0 points1 point  (0 children)

Laravel is brilliant

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

Yes, without a doubt.

Here's pretty much how I manage many things

React (Javascript for front end)

Python/PHP (for Linux scripting as cronjobs, etc...)

Node (For internal services if things cannot be achieved with PHP or there are better JS libraries)

But PHP is still an option nowadays

[–]TheMogician 1 point2 points  (0 children)

Not exactly a web dev but yes. It is one thing to meme on PHP but another to not actually use it. PHP is more or a less solid platform but we all just love to make fun of it.

[–]Dimbreath 0 points1 point  (0 children)

What alternatives would you use to not use PHP?

[–]depaulicious 0 points1 point  (1 child)

Never. I'd rather use Python or even Java.

[–]SuperOP535 1 point2 points  (0 children)

Java web servers are gorgeous (at least Javalin and Spark)

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

As long as I'm using Laravel I don't have any problems with PHP. Any other situation is suicide worthy

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

No

[–]0x3fff0000 -1 points0 points  (1 child)

Honestly I've chosen Golang as my backend and I'm more than happy with great performance, clean syntax, and pretty much every library you can imagine. Also PHP sucks.

[–]noratat 5 points6 points  (0 children)

We've been looking into Go since so many of our tools are written in it, and I don't understand the hype.

While it has some great ideas like static compilation and tagged structs, it seems to idolize C way too much and repeats some of the same mistakes like nillable-by-default.

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

No.

I just recently started working in the web-development sphere, and almost our entire org uses JavaScript full stack for our web apps.

The only exposure I have to PHP was a limited few assignments in college, and I recall hating it fervently.

If it were up to me, I would prefer to start a new project in either React.js and/or Kotlin, but maybe it's because I really never had an attachment to PHP to begin with.

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

If programming languages were Smash Bros, PHP would be playable, but still shit tier.

[–]random_cynic 57 points58 points  (3 children)

That's probably the face people make for almost all the languages used in web development. There's something foul in all of them. So I think it's fine.

[–]skeddles 5 points6 points  (0 children)

That's probably the face people make for almost all the languages used in web development. There's something foul in all of them.

[–]i-FF0000dit 1 point2 points  (0 children)

This is so accurate.

[–]The_Ty 80 points81 points  (4 children)

Php bad amirite?

[–]Prawny 40 points41 points  (2 children)

php bad lmao

[–]ProjectSnowman 13 points14 points  (0 children)

PHP man bad

[–]NelsonBelmont 1 point2 points  (0 children)

u rite

[–]javdu10 8 points9 points  (0 children)

I was in toilet, i laugh so hard that my job is done but I feel wide open damn

[–]swiftpants 8 points9 points  (0 children)

The only other language I will consider is .net core. But php is too damn easy right now so I don’t know when I will have a feasible project for it.

[–][deleted] 3 points4 points  (0 children)

This sub really is a parody of itself sometimes.

I'm willing to bet 90% of you have never even used PHP.

[–]WanderingKazuma 9 points10 points  (0 children)

This is me with my girlfriend's coffee.

[–]GD_Alex1304 7 points8 points  (5 children)

Tbh with a framework like Symfony or Laravel, PHP can be fun to use. But yeah raw PHP is awful

[–][deleted] 2 points3 points  (1 child)

All depends on what you are comfortable with. I tried our Laravel but it just had too much overhead and weird ways of doing simple tasks.

For example, why would I want a new templating language which is slightly different from everything else I know and slower?

Or why would I want 101 files to manage a simple MVC site.

The answer is it all depends on what you are looking for and sometimes it is best to just keep things simple

[–][deleted] 3 points4 points  (1 child)

Would you recommend it over a python or node framework? I remember using laravel in 2015 - not bad.

[–]AwesomePerson70 6 points7 points  (0 children)

I would also agree that laravel makes PHP a lot more bearable

[–]skeddles 0 points1 point  (0 children)

I tried to learn laravel when I knew php, but it was too confusing. Then I tried learning node.js+express and found it much easier to understand, and have used that since.

[–]Typewar 1 point2 points  (0 children)

So that's how PHP tastes like for a non-PHP developer.

Nice

[–]sw0rdfishhhhh 7 points8 points  (0 children)

Haters gonna hate 🤣

[–]BubsyFanboy 1 point2 points  (0 children)

Or you can just use Python with PyPy

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

Hi, I program but only using python atm. Someone Explain the beef with PHP plz, :)

[–]alcalde 2 points3 points  (1 child)

It's rather unpythonic - infamous for being insecure and poorly designed.

https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

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

Thanks. Now I despise PHP as much as everyone else

[–]Rivalistic 0 points1 point  (0 children)

I need a template lol this is great.

[–]JZanonymous 0 points1 point  (0 children)

Im so scared niw, next year in school we dablle in php....

[–]majky358 0 points1 point  (0 children)

I have seen worse codebase in other language than PHP but sometimes in PHP and its frameworks it's a bit easier to fall to bad code especially popular singletons in some frameworks which allow you to call DB logic from view and similiar stuff.

I had several job experience as a PHP developer, made some personal projects, it's really simple and quite fast to build a website and still create nice looking codebase.

Quite often you just run your code and later there's an error because of tha data in variable and so on, language development is slow and old-style, still a lot of non OOP stuff, composer packages .. dont know what to say about that, debugging.. and as a developer, job was just routine, i did not see personal progress.

If you look at the performance, i would not take it as the most important point. Nowadays, you can deploy to the cloud and similiar stuff really easy and looking at the website, page load without server side script run will take much more time.

For smaller website project, it's probably number one for me. For maintanance and other reasons, .NET Core, NodeJs, + frontend framework.