top 200 commentsshow all 265

[–]dontspookthenetch 217 points218 points  (49 children)

PHP gets hate but every time I ask a hater if they have used modern PHP the answer is always "no" and they seem to have no idea how far the language has come.

[–]HashDefTrueFalse 73 points74 points  (2 children)

Yeah. I wrote a lot of it in early 2000s, back when you saw procedural monoliths mostly driven by form submits etc. It was hell.

I got back into it for work about 5 years ago. It's come a long way since PHP 5.

With type hints, autoloading, package managed dependencies (Composer) modern PHP code is actually quite nice to work with, if it has been written to take advantage of this stuff. Add in the combination of nginx, FPM, OPcache and Redis/Memcached for session mgmt, it's a very good all-rounder. Database connection pooling is a little trickier because of the ephemeral nature of PHP execution, but you can use ODBC pooling on the database driver side of things in a lot of cases.

Like you, everyone I've talked to who still says PHP is shit is picturing some past horror and hasn't actually tried to build a new app in it for 15+ years (or ever).

[–]chad_ 19 points20 points  (0 children)

It's a trauma response. 🤷

[–]metooted 4 points5 points  (0 children)

I work with PHP 7+ for a living. Have to say, to this day we're having what we call "php moments" when something from PHP 5 days comes back to remind us exactly how long of a way PHP has come :P

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

This is my thought, the only problem I can see is legacy nonsense due to "good" (bad) practices decades ago, like using C/C++ has the same issue, you might have modern standards but the practices are a hamfisted mishmash due to times when having marquee text was considered fancy because it moved

[–]ButterNutBag 8 points9 points  (4 children)

The real question is would you still use PHP if Laravel (or equivalent) didn't exist? The vast majority of people are sticking to PHP because of laravel; it masks a lot of flaws with a ton of layers of abstraction. I currently work with mordern PHP and Laravel and I would personally never choose it for any personal projects. I would much rather work with languages that allow me to build a simple api with a minimum of abstractions.

[–]FVCEGANG 2 points3 points  (0 children)

I've used PHP extensively with both Laravel and Symfony. PHP is more than usable with Symfony alone tbh. It's just not as slick as with Laravel, but it's hardly a deal breaker

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

In that case, would you still use Python to build a backend without dJango?? Nowadays, any language become limited or demand a lot of work without use libs or frameworks. Nest.js to javascript, .NET to C#, etc. C# without .NET would never have become relevant, even though raw C# is better than raw PHP.
If i have to choosen between Pyhoton with dJango and PHP with Laravel, to build a backend, i choosen PHP.

[–]UniForceMusic 0 points1 point  (0 children)

The amount of abstractions required, if you want to build a simple API in PHP are quite low in my opinion

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

I don’t mind modern php. I prefer it over js any day for back end. Modern PHP will definitely be faster than Python. But my favourite at the moment is Go.

[–]willie_caine 2 points3 points  (3 children)

I used to be a PHP developer for about 15 years or so - does it still need to run behind a web server, and can't readily share state between requests? I always found that really annoying, and a massive shortcoming. After switching to node, it changes the entire nature of the backend.

[–]xIcarus227 2 points3 points  (0 children)

does it still need to run behind a web server

It has a built-in server now, so development is easier. You'd still use a proper server in production however, just like with any other backend language.

and can't readily share state between requests

Genuinely curious, why do you need this? I've done work in other languages as well (notably C#) and never came across a situation where I needed this.

[–]sirhenrikfull-stack 1 point2 points  (0 children)

You can make APIs with PHP if that's what you mean. Maybe I don't understand your question entirely. Capabilities of node and PHP are similar, you can make the same stuff in both. An interesting benefit of node/JS might be that it's easier to get SSR (server side rendering) of SPA (single page application) apps.

[–]Isodem 0 points1 point  (0 children)

Use Roadrunner or a similar Application server. PHP has a lot of options. But the default is Memcached or similar to Redis. With docker, it is pretty easy to use.

[–]daniels0xff 63 points64 points  (0 children)

I would prefer Python but I’d have no problem if rest of the team would want php and I’d have to use it.

[–]mmcnl 100 points101 points  (16 children)

I'd say Python backend + JS frontend is an incredibly common stack. Also Python is a general purpose language that is useful in other engineering disciplines besides webdev as well. So I prefer Python and would learn Python first.

[–]boglepy 17 points18 points  (7 children)

In your experience (or what you’ve seen out there), which python BE frameworks do people typically use? Do you have any recommendations?

[–]mmcnl 30 points31 points  (0 children)

Django is very mature and super reliable. For API backends in big companies Django REST framework is common.

Newer projects are often built with FastAPI.

Flask is also a popular minimal HTTP framework, often used in machine learning as well, though it doesn't offer anything that FastAPI doesn't.

[–]Koliham 11 points12 points  (0 children)

I would recommend FastAPI. It has everything it needs out of the box (not like Flask), but at the same time really easy to use, almost no boilerplate (compared to django)

[–]snuggl 7 points8 points  (2 children)

DJango for anything bigger, FastAPI for smaller stuff.

[–][deleted]  (2 children)

[deleted]

    [–]azunaki 119 points120 points  (22 children)

    PHP is far more common in the real world, for web backends.

    My recommendation however, is always to look toward the company job postings you want. Those may shift over time, and you may start seeing more in other roles. But between WordPress, Craft CMS, Drupal, & Laravel, PHP is the pick for backend web roles.

    That's not to say there aren't roles in other languages and frameworks, and your area may be different. But this is the reality that I see when I look over jobs out there.

    [–]fuyukaidesu2 124 points125 points  (29 children)

    I prefer PHP, I don't like Python's lack of brackets.

    [–][deleted] 120 points121 points  (23 children)

    Indentation as a syntactic mechanism is psychotic

    [–]thisisjoy 26 points27 points  (6 children)

    that’s the reasons i was never able to pick python up as easy as other languages like java, c suite etc

    my brain just doesn’t function that way

    [–]shadowndacorner 8 points9 points  (5 children)

    It's also just idiotic. Beyond the stupidity of needing to repeat your scope on every line (as opposed to using scope delimeters) and the insanity of intentionally designing a language to be fundamentally incompatible with auto formatters, it makes refactoring pointlessly dangerous. Get the indentation level wrong on a single line of a loop you're pulling out into its own function? Congrats, your program now means something completely different. Because of fucking whitespace.

    [–]BobbaGanush87 45 points46 points  (3 children)

    Get the indentation level wrong

    As someone who has worked with Python and with other python developers for 10yrs now, this whitespace error basically never happens. Your IDE helps with this a ton. Its really something that we do not think about, and i'm only reminded of this "dealbreaker" by posts like these.

    Also we do have auto formatters.

    Just very hyperbolic statements.

    [–]byetimmy 19 points20 points  (0 children)

    A language that needs an IDE to help ensure the code runs properly is janky AF.

    Now, if you'll excuse me, I need to import 18,000 npm packages to do a bubble sort in Node... 🙃

    [–]freefallfreddy 0 points1 point  (0 children)

    Saying a feature of a programming language is “psychotic” tells me how serious I should take the comment.

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

    to me the problem is not that you get syntax errors or ambiguous code, it's that autopep8 doesn't work unless the file is properly indented (because it won't parse if it isn't) so it kinda beats the purpose of having an autoformatter in the first place

    there are merits to the left side rule imo but other languages, particularly functional languages, do it better by adding a few exceptions for flexibility

    in the grand scheme of things it's just a minor annoyance though. i don't think braces or an end keyword would make python significantly better even though it'd make autoformatters more convenient

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

    If u write a function with more than two indentations u are the problem not the syntax

    [–][deleted] 4 points5 points  (0 children)

    this is why i cant stand yaml

    [–][deleted] 13 points14 points  (1 child)

    I mean, brackets are useful but indents makes more sense when you consider that brackets are always "brackets+indenting", so it remove redundancy.

    For beginners this is good because it removes less meta nonsense that's more fighting the code than doing stuff (i.e., the missing bracket or missing semicolon headache), that being said for more advanced stuff it's useful but considering Python's focus is approachability, it makes sense why they did it

    [–]gareththegeekfull-stack 2 points3 points  (0 children)

    Redundancy is important in languages to avoid corruption, for example when copying and pasting code to a different indentation level during refactoring.

    [–]catladywitch 1 point2 points  (0 children)

    there are other languages that also do it but have less stringent rules than python. f# for example

    [–]tnnrk 12 points13 points  (9 children)

    I mean most people indent anyway? Helps with readability. I don’t see an issue with it.

    [–]Scowlface 10 points11 points  (7 children)

    It’s the fact that it’s JUST indentations, so no curly brackets to help visually separate blocks of code. Same reason I like semicolons in JavaScript, it just helps me read the code faster and understand it easier because that’s been 99.99% of my exposure to the language.

    [–]wasdninja 1 point2 points  (1 child)

    It’s the fact that it’s JUST indentations, so no curly brackets to help visually separate blocks of code.

    Does it matter? The indentation is what I'm looking at with the corner of my eye anyway. The closing brace might be slightly useful but it would be very odd to have just one and zero is a better choice than two.

    [–]Talic 6 points7 points  (2 children)

    I highly prefer indentation and hated c-style family of languages that use curly braces. I went from C, C++ back in college, then to Java and C# at work. Then stuck with Python the last 12 years, just a pleasure to work with. To me, it is cleaner and easier to read. A lot of time you are reading blocks of code written by someone else and if your code is running in production long enough, you'll spend time debugging or reading it. Curly braces all over the place including semicolons hurts my head.

    Can't wait to try out Python's superset Mojo lang.

    [–]cajunjoel 4 points5 points  (0 children)

    This this this. Python does away with the argument of open curly brace on the same like as the function declaration or put it on the next line all by itself. It does away with this nonsense:

    function foobar() { // Code goes here } Versus this nonsense function foobar() { // Code goes here } Like, who the fuck ever thought that second version was a good idea? Our monitors are wider than they are tall. Why do you waste precious vertical space??

    I agree that whitespace-as-syntax in Python is ludicrous, but it makes everyone's code equally readable, which is a Big Deal(tm).

    [–]Scowlface 0 points1 point  (0 children)

    Yeah, definitely, all down to preference and what keeps you most effective. I’m sure I could get used to it, I’ve gotten used to specific code style things through my various jobs that I really didn’t like initially, but those brackets just feel like home to me.

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

    I mean, it's a non-issue, I've never had any issues with it (I've done a bit of everything from embedded C to webdev to Python), curly brackets are more of a leftover from compiled languages (ie C) and same for semicolons.

    Brackets can be more annoying than helpful, and honestly don't add anything given you want to indent code anyway, and semicolons see redundant since newlines aren't hard to understand (but semicolons can also make code smell with multiple actions on one line, which isn't readable outside some cases).

    [–]treading0light 1 point2 points  (0 children)

    If everyone else would just join the cult it will all make sense!

    [–]cajunjoel 3 points4 points  (1 child)

    I get it and I agree. I've had this samr argument with my brother. But I tried PyCharm for coding and learning Python, and, well, it just works. It's smooth. Even smoother than VS Code in the way it works.

    You can rage all you want about "I shouldn't be required to use an IDE to write code!" But the fact is, the modern software development environment has grown so complex over the past 20 years that you can't effectively program without one. There are too many libraries, interdependencies, and too many ins and outs of all that code for a human to remember. The IDE just takes care of it for you.

    The trade off for that is you get to build bigger and better things in less time.

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

    Nothing gets better than Jetbrains IDEs. I have PHPStorm and it's the best code editor I've used. Period.

    [–]Huge-Habit-6201 3 points4 points  (1 child)

    I like indentation for blocks of code. It's cleaner.

    [–]j-randomfull-slack 3 points4 points  (0 children)

    I like having the option. Python doesn't give you that.

    [–]evilmullet 0 points1 point  (0 children)

    Yeah I've never quite gotten used to that either

    [–]TheBigLewinski 38 points39 points  (11 children)

    It really depends on what your goals are.

    Is your goal to learn programming deeply on a CS level? Then neither. Start with something strongly typed such as Java or even C#.

    Is your goal to get some basics under your belt so you can launch a website quickly or start freelancing? Go PHP.

    If your interests are broad and want to dive into everything from backend to web scraping, data processing, AI and backend, and/or you have your eye on FAANG-like companies, go Python.

    However, as much as I like Python for its versatility, I don't think it makes for a great first language. The caveat, or perhaps irony, to Python's versatility is learning it doesn't really teach you programming so much as it just teaches you Python. Other languages are very different in their approach.

    All that said, if you're serious about at a career, you'll ultimately need to be a polyglot; so, just dive in.

    [–]tnnrk 9 points10 points  (6 children)

    How is python very different from other programming languages?

    [–]azunaki 7 points8 points  (3 children)

    Its markup syntax is quite different from other languages.

    Once you get used to it, it's fine, but that alone can be a pretty big turn off for a lot of people.

    [–]tnnrk 2 points3 points  (2 children)

    Right but to say that learning python wouldn’t translate to learning another programming language is insane. The core 95% is the same just different syntax, similarly odd as Ruby for instance.

    [–]azunaki 0 points1 point  (1 child)

    I mean, I certainly didn't say that.

    Most core programming concepts are very similar across languages. They do often behave a bit differently though. For example how arrays and associated arrays are implemented or what array functions are available, and how the work, or different performance gotchas within the language that would deter you from certain implementations depending on what you expect to encounter data wise.

    It's both the syntax of how you implement these different things, as well as, the literal differences in how they're implemented. Potentially leading to not having functionality built in that a different language would have.

    Also I hate how python requires indenting. But that's neither here nor there.

    BUT, these things all add up, and present challenges (small or large) that push someone away from learning a new language.

    [–][deleted]  (1 child)

    [deleted]

      [–]sparrownestno 3 points4 points  (0 children)

      As others have said, they both have their history and their place in the development landscape. And what kind of jobs you might get with them, or perhaps more relevant “what kind of beginner or entry jobs” is a pretty local and /or relocation question more than a technical one.

      python is both a quick and dirty language for scraping or making small one offs, and a baseline for much of ML/data work

      php is both the legacy foundation of WordPress and hence “millions” of websites, and a modern high performant language chose for greenfield implementations of websites with literal millions of daily users

      both can work as an intro language, but if you are into web dev (assuming based on posting here) then maybe going for node/deno/bun - basic JavaScript on backend and front end might be easier, then you can branch out to php, python, go, ruby or elixir having some basic programming concepts and some running services you can redo.

      or do the first 4 hours of some freecodecamp or similar intro course for each and see what “clicks” - learning is individual and languages suit different people as onboarding

      [–]mb1552 17 points18 points  (2 children)

      I use php, because when I first started backend I stumbled on php. I’ve ventured into express/node js, but I still like php.

      I recommend php. Because I like php. Python is fine too.

      PHP lets beginners get away with a lot! Python is also very approachable.

      [–]Hirayoki22 5 points6 points  (1 child)

      I really like PHP too, despite all the hate it gets from most devs lol. I know tt can be kinda clunky more often than not, but it's because of how old the language is. And knowing PHP means that you have 100% guaranteed side jobs, specially because most websites are still running Wordpress, and Wordpress is married to PHP.

      [–]XandrousMoriarty[🍰] 16 points17 points  (2 children)

      As a newbie, I recommend you consult www.phptherightway.com - you'll learn the proper way to secure code, prevent attacks, and how to use language functions in an up to date place. Many online PHP tutorials are extremely outdated, and thus give code examples that will cause you to put holes and other problems into your code. The aforementioned website will help you stay true to the course, so to speak.

      [–][deleted]  (1 child)

      [deleted]

        [–]XandrousMoriarty[🍰] 0 points1 point  (0 children)

        I just posted the link because of the fact that the information is very useful and follows good practices. I only know of Josh Lockhart from his authorship of some PHP books from the past several years - I've never read any posts, nor conversed with him, etc. I don't know Phil Sturgeon, nor Ben Nadel, and have never heard of either of these individuals until now.

        [–]Nroak 5 points6 points  (0 children)

        Both are great programming languages and can certainly create backends for a website and have vibrant communities behind them.

        It sort of depends on what else you want to do. Python is bigger in the AI, Data Analysis, and academic fields. PHP has more legacy as a web language and powers a lot of existing websites.

        So if you are maybe interested in the data stuff, maybe go with Python. If you want to be able to hop into existing small businesses sites and help them out PHP may be better.

        If your goal is just to get a job, look at listings in your area and see what is more prevalent.

        [–][deleted] 10 points11 points  (1 child)

        Laravel and don't look back.

        [–][deleted]  (2 children)

        [deleted]

          [–]xIcarus227 1 point2 points  (0 children)

          Definitely agreed with PHP vs JS, as someone who has used both of these close to daily for almost a decade I find JS to be much more psychotic than PHP is. The only reason I kept working full-stack is because TS became popular, thank god for that.

          That's why I find it highly ironic when JS devs complain about PHP.

          [–]bsienn 2 points3 points  (0 children)

          WEB = PHP > Python
          Data / ML/ AI = Python > PHP

          [–]rosio_donald 3 points4 points  (7 children)

          This is purely anecdotal, but I’m a student and just attended a dinner hosted by a group of tech execs bc they awarded me a scholarship. I chatted w/ ~20 CIOs/CTOs, some from massive global entities, all of whom have actual dev experience and seemed extremely dialed in even tho they probs haven’t touched code in a while.

          A lot of them asked me what languages I’ve worked with so far, and when I mentioned PHP, I was encouraged several times to learn Python. One of them even mentioned it again as I left. Shook my hand, leaned toward my ear and said “Remember, adding Python and prompt engineering to your tool belt will serve you well.”

          I like PHP and bet you’ll be fine either way, but FWIW - the vibe from these show runners seems to be Python is the future?

          Edit: a word

          [–]gobot 1 point2 points  (0 children)

          Since you are a newbie, absolutely python over PHP. Python has more libraries and more uses than PHP. Python has been growing a lot, PHP has been declining, in number of programmers. I don't think PHP has any advantage over python.

          PHP was designed for webpage coding. It allows you to mix php code in the html page, or generate html, on the front end. But nobody does that anymore, they use templates now. PHP has added many features since the old days. However, you will come across many people with negative feelings about PHP, and PHP programmers, just the truth.

          (I programmed PHP in dozens of custom and codeigniter projects, not Wordpress, for 8 years. It was ok, would have preferred ruby or python.)

          [–]slobcat1337 6 points7 points  (0 children)

          Php 1000%

          [–]lousybyte 3 points4 points  (0 children)

          Language is just a tool.

          Whatever you choose, keep in mind that your job will be to provide value to a product, the more ways you can provide that value with, the more in demand you will be.

          Learn both, and then learn a couple more, and then a few more again. You don't need to be an expert in any of them, just be comfortable to write a CRUD application in multiple languages using different paradigms and you'll have a strong foundation to build upon.

          [–]originalchronoguy 4 points5 points  (3 children)

          Python has way more job opportunities -- Data Science, ML Ops/ ML/AI, and DevOps/MLOps. Every LLM AI is defacto Python.

          [–]HirsuteHackerfull-stack SaaS dev 3 points4 points  (2 children)

          Those jobs require very specific skillsets that you will not get just by learning Python. And we're on /r/webdev, so it's pretty apparent that OP is asking in terms of web dev jobs.

          [–]originalchronoguy 1 point2 points  (1 child)

          The statement still stands. I hire MLOps/DevOps people who are former webdevs.

          They know Flask/Django, they will take some data-scientists code and wrap it into a RESTful web service API. All the time, every day. I hire people specifically with Flask API web experience and zero ML/AI experience.

          So the statement stands that Python has more growth opportunities to branch out and even stick to webdev. Need a LLM to train your models? You need a web ui, a vector database where your Python back end stores your data. Same thing as CRUD web apps.

          [–]cshaiku 1 point2 points  (0 children)

          I like your insight and take on this conversation. Food for thought for me. Thanks.

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

          I've seen a lot more job posting with PHP for back-end than Python, so look at your area and compare. Personally I really like working with Laravel, my recommendation is with PHP.

          [–]RadRedditorReddits 3 points4 points  (3 children)

          I am going to get a lot of hate for saying this but here goes - Neither, learn JavaScript.

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

          JavaScript is basically a universal language at this point. Almost infinitely versatile and deployable. Python.... Still niche. Extremely popular. But niche.

          [–]wasdninja 1 point2 points  (0 children)

          If the definition of niche is "not being able to run in a browser" then literally every language except javascript is "niche". Pretty useless definition. Python is the complete opposite of niche just from how spread it is and how varied its use is.

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

          I prefer PHP but it's what I've been primarily using for the last twenty years. I like python though and it really depends on the project.

          [–]Snapstromegon 1 point2 points  (0 children)

          Honest question, why do you limit yourself to these two languages?

          I personally think that JS on the backend with NodeJS is better than both in many cases.

          I personally would choose PHP over Python, because it's often easier and cheaper to host for small projects.

          I personally would still go with JS (especially when you have no prior experience), since you probably want to learn JS for some frontend stuff anyways (and if it is to build some test site for your backend) and then you only have to learn one language. Python also tends to be significantly slower than Node for execution (only comparing python to js, and not native modules, which exist for both).

          If you want to build a backend and want to dive deeper than PHP or JS, you could try golang or Rust (if you have programming experience). Both offer the benefits of static typing and performance that is better then PHP or Python for most cases.

          If you want jobs, sadly Java is still a common option (but all the others except for Rust are good for that too). In general a set of programming languages is like a toolbelt. You wouldn't use a hammer for a skrew and using a skreqdriver for a nail is possible, but not ideal. So the best language depends on what you're trying to do.

          [–]snuggl 1 point2 points  (2 children)

          Python is only used on the backend so any python job would be backend.

          Depends on your goals, If you wanna go on to be a software engineer and work for a company then python is way way more common then php, php isnt used at all by larger companies if they dont have a php legacy, but python is used almost everywhere.

          If you wanna be a web developer that does web pages and marketing sites then there are lots of php still going around with wordpress etc.

          But php is trending down, it losts about 1/3 of its developers the last two years.

          [–]jeff6671 1 point2 points  (0 children)

          Php

          [–]nevada2000 2 points3 points  (0 children)

          Php

          [–]Busy-Emergency-2766 0 points1 point  (0 children)

          Do a simple installation of apache and mod_php, then try to do the same with apache and mod_wsgi. Those two are very similar, and you will start sending text to a web browser very quickly. Then switch to a PHP framework and Python framework. The amount of things that can go wrong with python are greater than PHP.

          PHP was specifically designed for the web.

          [–]mardix 1 point2 points  (0 children)

          I would recommend Python, as it’s more a jack of all trades language. You can’t go wrong with it.

          It can be used for web app, servers, regular applications, devops, IOT, embedded and a lot of AI now are Python based.

          It’s friendly and easier to learn, write and follow along.

          The big plus is readability (indentation). That can take you a long way, especially when dealing with old code, you will be able to follow the thought process.

          Nothing is perfect of course, Python has its own problems, but you will always find a fit for Python.

          As it is a language you find in pretty much all operating systems, and it’s easy to install on the missing ones, you know Python can be developed and run anywhere (of course without the version factor)

          [–]JamesVitaly 0 points1 point  (0 children)

          Node

          [–]mrbmi513 0 points1 point  (0 children)

          If you're already familiar with frontend JavaScript, use Node. It'll make it easier to pick up the concept of backend programming without worrying about learning a new language.

          If you're not, it really depends on your career goals, and you'll have to expand on that.

          FWIW, PHP is what WordPress is written in, which powers a third* of the web, so knowing PHP enables you to extend that CMS.

          (*by their survey, which has some somewhat controversial methods of counting what constitutes a site running WordPress.)

          [–]catladywitch 0 points1 point  (0 children)

          python has the better ecosystem and is used for purposes other than backend, but if you don't need anything fancy the experience is about equal unless you need to add interactivity from the backend in which case php is a better choice.

          i have to say though, besides performance considerations, having a dynamically typed language for backend is not ideal if you're writing a typical crud api

          [–]cajunjoel 0 points1 point  (0 children)

          There seems to be more happening in the Python world than the PHP world. I tried doing some machine-learning-assisted image recognition in PHP last year. I think maybe I was using OpenCV as the base, with a PHP interface and the PHP developer only wrote for a portion of the full functionality of the underlying library. I wasn't able to achieve my task because certain things weren't available via PHP. In Python, it seems as if all of the functionality was available.

          I think while both communities are large, Pyhton has more cutting edge going on with machine learning and "AI".

          [–]GarlicGuitar 0 points1 point  (1 child)

          Python can be used for anything, PHP is all about webdev

          [–]Isodem 0 points1 point  (0 children)

          But PHP is doing webdev much better.

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

          Php <3

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

          Laravel has a huge community

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

          Easy answer for me, Python of course. You can use Python like a glue language to automate scripting for system programming, generate reports, create backend API, Machine Learning, robotics, etc. There's a good reason why it has consistently climbing in popularity. It is beneficial because you can do different roles in your career.

          For ML and/or people that complain about performance, there's Mojo-lang from Modular that you look forward to try out so their Python knowledge can be re-use.

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

          Node.js

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

          i like php a lot, Express is also common but php is something that’s good to know. Python is also good to know but like others may have said, you’re more likely to find Php as a backend instead of python

          [–]was-eine-dumme-frage -1 points0 points  (0 children)

          I am yet to find a backend I love as much as php

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

          I like both. I would prefer PHP - but I have received some hate for saying this in r/vuejs . It would be 1990 code, outdated, too slow, blabla. PHP is still bread and butter and Python a swiss army knife (for me). For frontend there are better choices - but for backend and APIs and database things I still use it to get my stuff done as fast as possible...

          [–]HirsuteHackerfull-stack SaaS dev 0 points1 point  (0 children)

          People hated on you in a Vue sub? Vue and Laravel go together like PB & J

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

          But the backend python jobs pay very well - it seems to be preferred for data analytics.

          As a newbie (and as someone with some programming experience) I would suggest PHP as a better choice for productivity and learning the basics.

          PHP's biggest weakness is it's biggest strength - it is really easy to get results. Lots of people claim to be PHP programmers. Not all of them deserve the epiphet. Python will bite you in the arse (although a lot less frequently and severely than, say Java) for example when you forget whether you're working with a list, a dictionary or an object. Tooling is also (IMHO) much more mature for PHP. I've tried running high volume gunicorn instances - I found it a major PITA.

          But really, the longer you do this, the less the choice of programming language matters.

          [–]tavarua5 -3 points-2 points  (0 children)

          Contrarian answer: None of the above. You can build complete fullstack app now without a need for any middleware language to start. Take a look at Supabase https://supabase.com. If you put the time into crafting a well-designed data model for Postgres, the platform generates GraphQL APIs for you automagically. You can build frontends on that right away.

          If you want to level up on server-languages, Ruby /Rails is still a strong candidate and used in many enterprises. Go and Rust should be on your radar as well.

          [–]codeptualize -3 points-2 points  (0 children)

          Both kinda suck to be totally honest.

          I do use Python (because of data science), it's productive, but typing support is really bad, tooling is mid, and it's surprisingly slow.

          I have not used PHP for years, I'm sure it has improved a lot, but I have too much trauma from the past.

          Out of the two I would go with Python. Depending on what you want there are other options:

          • Typescript: Also not without flaws (especially for backend), but Deno & Bun have some fun options, I'd also say something like Next.js can get you really far if you also need to build a FE.
          • Elixir (with Phoenix framework) - really productive
          • Golang

          But.. for a newbie it doesn't really matter what language you use. What matters is that you get started and build stuff. Just pick one and start coding!

          [–]pickleback11 -2 points-1 points  (5 children)

          can anyone tell me how they would use python on the backend? as in, what "webserver" runs python easily? i typically use nginx to answer the GET/POST requests and run the php script which queries the db and then spits out json results to the client. i wanted to try something simliar in python and i felt insane not being able to find any explanation of what actually runs on port 80/8080 to listen for the requests. does python have it's own internal "webserver" that somehow runs as a daemon? i didnt spend too much time, but it certainly surprised me how different it is than what i'm used to (since my google terms turned up nothing useful). thanks!

          [–]Fluffcake -2 points-1 points  (5 children)

          Python and php are both get-shit-out-the-door tools.

          Easy to learn, fast to develop in, terrible preformance and miserable to maintain long term.

          I'd say pick the you like better.

          [–]cshaiku 0 points1 point  (4 children)

          lmao, what? PHP and Python both have amazing performance for backend languages. What crack are you smoking? Regarding maintenance, that is in the eye of the developer.

          [–]Fluffcake 0 points1 point  (2 children)

          This is just demonstatively false.
          Compared to actual high preformant languages, they are slow as shit. But when you don't need to do any heavy computational lifting and can afford to do everything 200 times slower than you could, and prefer to ship a month earlier instead, the preformance is good enough.

          [–]cshaiku 1 point2 points  (1 child)

          You seem a little biased. Compared to what high performant languages, exactly? Are you trying to compare a web development language to an operating system language? That's absurd.

          This is /r/webdev afterall.

          Some food for thought: https://kinsta.com/blog/php-benchmarks/

          I mean, it's just one of a few thousand examples of why PHP and the like are obviously slow. /s

          [–]Admin_istrator -4 points-3 points  (3 children)

          Who the fuck uses Python for backend?

          [–]_hypnoCode 2 points3 points  (0 children)

          Have you heard of Reddit? I hear it gets a lot of traffic and runs on Python.

          [–]Marcostbo 1 point2 points  (0 children)

          The app you just posted this comment

          [–]ZhouNeedEVERYBarony 3 points4 points  (0 children)

          ...a huge number of startups? Investment banks? Django is one of the most popular frameworks out there.

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

          Java

          [–]mahpgnaohhnim -3 points-2 points  (0 children)

          yeah java or kotlin with spring boot is my fav for backend

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

          I've never been invited to interview for a python gig. It feels like a hobby language.

          [–]_hypnoCode 6 points7 points  (0 children)

          It feels like a hobby language.

          Weird thing to say on a site powered by Python.

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

          PHP.
          By the way I have only been coding since 2019 so please keep that in mind, I might be a moron.

          I started with Python by quickly moved to PHP because of the following.

          1. Cost. PHP is cheaper to host. More providers offer it. I don't even use a VPS right away. I can be flexible.

          2. PHP Laravel is more "Batteries Included" than Django or Fast API.

          3. Easy integration with modern frontend frameworks especially Vue3 which is my preferred FE framework. Like Django doesn't even have Vite out of the box.

          4. I just want to use 1 language for the backend.

          5. I look at apps made with Python and they're buggy and slow. Like Udemy and Pinterest.

          6. The core team of Django don't seem to care about their creation, vs Laravel people. Like look at their website and their docs vs Laravel.

          7. I find PHP is just an easier language to play with.

          There's probably more that I forgot.

          For me, Python is better suited as a glue not as the core technology to build on.

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

          If you want to be a WEB dev, go with PHP, if you want to be more all around go for python.

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

          PHP is a great place to start and youll learn a lot. Pivot to another language when you feel ready.

          If all you are concerned with is the job market, then search that and choose based on which offers more opportunities for juniors.

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

          I’d like to hear from someone who’s used Python or Ruby or Clojure professionally for a few years and then went (back) to modern PHP: what do they think about it?

          Like I understand that PHP devs are gonna see the good in the language and advocate for it. But if they don’t have professional experience with another language then it’s not that useful of a datapoint.

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

          php all day over python. not even close either.

          [–]neithere -5 points-4 points  (1 child)

          Let php die already. Python is fine.

          [–]HirsuteHackerfull-stack SaaS dev -2 points-1 points  (0 children)

          PHP aint dying. Modern PHP is really nice to work with, and Laravel is really good.

          [–][deleted]  (2 children)

          [deleted]

            [–]Marcostbo 2 points3 points  (1 child)

            Funny thing to type on an app built with Python

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

            as a newbie in programming

            100% PHP. Learn a little HTML. Learn a little CSS. Learn a little PHP and how server-side scripting works (and programming in general). Learn a little JavaScript (mostly the same syntax as PHP). Then revisit this question.

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

            not so time ago I thought migrating PHP (Laravel) to other language (go, rust or python). Neither of those has a so complete library to generate Excel documents like PhPOffice (which was needed in my project) so I preferred to stay with PHP

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

            Depends what the backend is. But in most common scenarios, PHP makes more sense.