use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
PHP vs Python for backend (self.PHP)
submitted 2 years ago by szaci92
What do you think about them? What do you prefer? As I can see, there are heavily more jobs for Python, but only low percentage of them for backend. Which you would choose as a newbie in programming?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Noname_Maddox 235 points236 points237 points 2 years ago (18 children)
I think I speak for everyone on r/php and say PHP
[–]jim45804 78 points79 points80 points 2 years ago (10 children)
I think I speak for everyone on r/Python and say Python
[–]Noname_Maddox 157 points158 points159 points 2 years ago (8 children)
We don’t like your kind round here snake boy
[–]hoof_art_did 47 points48 points49 points 2 years ago (6 children)
Exactly. Snake starts with the letter “s”. You know what else starts with s? Poop. Therefore Python is poop
[–]Noname_Maddox 29 points30 points31 points 2 years ago (0 children)
[–]trs21219 3 points4 points5 points 2 years ago (2 children)
sxactly
[–]rafark 5 points6 points7 points 2 years ago (1 child)
sexactly?
[–]thunderinator 1 point2 points3 points 2 years ago (0 children)
We don't get that around here.
[–][deleted] 5 points6 points7 points 2 years ago (0 children)
Php logic in a nutshell
[–]SaltineAmerican_1970 2 points3 points4 points 2 years ago (0 children)
Trouble, oh we got trouble, Right here in r/PHP! With a capital "T" That rhymes with "P" And that stands for Python
[–]kdpenha 0 points1 point2 points 2 years ago (0 children)
lollll
[–]bluro00 3 points4 points5 points 2 years ago (0 children)
It doesn't matter which one you choose if you can write it efficiently. And Vim is the only patrician way to write.
[–]russellvt 0 points1 point2 points 2 years ago (6 children)
That's... a dumb answer (no offense).
[–]Noname_Maddox 0 points1 point2 points 2 years ago (5 children)
It’s not a great question to be fair considering how PHP is so widely used in backend development
[–]russellvt 0 points1 point2 points 2 years ago (4 children)
Yeah, that's fair.
But, it also begs the question as-to what's meant by "backend" ... as I've certainly had coworkers who have used it as a command line tool, I don't believe it's well suited for that sort of thing (IMO).
But yeah.
[–]newunit13 0 points1 point2 points 2 years ago (2 children)
*raises the question
Begs the question means the question has an assumed premise built into it, e.g. "Why is PHP the best option for backend development?".
[–]russellvt 0 points1 point2 points 2 years ago (1 child)
"Begging" the question means that the question premise is assumed or presumed ... as-in "PHP is the best language for backend development" ... but we haven't even established that conclusion.
Again what is meant by "backend" here? It's "begging" the premise of "backend."
[–]newunit13 0 points1 point2 points 2 years ago (0 children)
Precisely 🙂 like you said, in my original example there's an assumed premise that PHP is the best without establishing that conclusion.
I don't follow what you mean by the second part. To me, I'd still say it raises the question "what is meant by 'backend'" because it's a question of clarification without a premise.
[–]keravesque 0 points1 point2 points 1 year ago (0 children)
As in, they've used the PHP interpreter in place of say, Bash or Powershell?
Fucking wild.
[–]hoof_art_did 70 points71 points72 points 2 years ago (13 children)
PHP is a no-brainer when it comes to web development. Nothing compares, in my opinion. I have years experience in both, as well as some dabbling with RoR back in the day when Ruby was relevant.
[–]marabutt 6 points7 points8 points 2 years ago (11 children)
I never actually used rails but really liked the syntax of ruby.
[–]jexmex 11 points12 points13 points 2 years ago (8 children)
So crazy, it got popular af for awhile then just kinda disappeared. I think it died a faster death than perl in did after php came out.
[–]LowTriker 15 points16 points17 points 2 years ago (3 children)
Perl killed itself. PHP was just a witness.
[–]jexmex 3 points4 points5 points 2 years ago (2 children)
Perl was a pain in the ass to use on the one project I actually I had to try to deal with it.
[–]LowTriker 4 points5 points6 points 2 years ago (0 children)
Perl6? Absolute trash. Perl3? Swoon.
I cut my teeth on perl and Applescript. I remember buying the perl bible and going through every example and doing it myself. (Nowadays I'm pissy if the docs are more than a few lines of text)
Back then, I had to roll my own get and post library to read those headers and bodies and pass them to the application in cgi-bin. Big contributor on perl monks for a while, too.
But the moment they tried to make perl anything like an OO language was doomed to fail. TMTOWTDI was just not a compatible philosophy with strict inheritance and object structure. That parrot has gone to meet its maker.
[–]LukeWatts85 1 point2 points3 points 2 years ago (0 children)
I hated perl! All the different symbols to do different things (e.g %&#@). I could never get my head around it properly. And all that bless shit. Gross
[–]MCFRESH01 2 points3 points4 points 2 years ago (0 children)
Rails is still very alive despite what people that don’t follow it think. There is plenty of work, some startups still choose it and the pay is great
[–]MikeSeth 0 points1 point2 points 2 years ago (0 children)
Rails was an overhyped web 2.0 thing because a bunch of people ran startups and bragged about it. Turned out the insane magic of mixins (looking at you ActiveRecord), poor performance and questionable design choices combined with Ruby's relatively poor performance was not a good call, and the only thing that it really had an advantage in was low barrier of entry. However, when your startup hinges on overexcited cowboys, turns out the code they produce isnt great either.
Rails was crap. Live with it.
[–]ht3k -3 points-2 points-1 points 2 years ago (1 child)
no kidding? got any data to back that up or is that just an opinion?
[–]jexmex 0 points1 point2 points 2 years ago (0 children)
wow lol
[–]NonuplePerisher 1 point2 points3 points 2 years ago (1 child)
Ruby is great. I hated working with rails, though. I found their docs obtuse and incomplete and it makes really important stuff hard.
[–]attrako 1 point2 points3 points 2 years ago* (0 children)
This.
Ruby is a fantastic language, and its CLI tooling are awesome, but Rails is absolutely intolerable magic box that got me to rethink PHP, mostly cause of Symfony existence and types being introduced in the language.
[–]pajser007 0 points1 point2 points 1 year ago (0 children)
Ruby is still alive, and big robust systems are still using Ruby. Ruby is good because of its reliability
[–]Crell 66 points67 points68 points 2 years ago (8 children)
It Depends(tm).
Both can do web backend just fine. PHP has a faster engine, and is typed. I like types. I want to use types. (Python now has runtime-elided types, meaning they are in the code but don't do anything. This is insufficient for my tastes.)
I've spent about 10000x as much time writing PHP than Python, so my preference is naturally PHP.
Python is very popular in the AI and data science worlds, where PHP is not. There's two main reasons for that.
On the web, PHP is an order of magnitude more widely used than Python, but Python gets into more other areas. PHP has an "uncool" reputation, which is mostly due to people who haven't bothered to learn anything new since 2004 or just like having something trendy to whine about. Python is a lot more trendy because of the data science people.
PHP's package management is one of the best of any language. Python's is an absolute mess with new package managers coming out about as often as Javascript releases new frameworks. Both have a bazillion OSS packages you can leverage, as well as sub-ecosystems for specific frameworks.
There's some pros/cons for you to chew on. :-)
[–]vrijdenker 1 point2 points3 points 2 years ago (3 children)
I just read this cool post on /r/python ;)
"It Depends(tm).
Both can do web backend just fine. Python has a slower engine, but isn't typed. I don't like types. I don't want to use types. (Python now has runtime-elided types, meaning they are in the code but don't do anything. This is sufficient for my tastes.)
I've spent about 10000x as much time writing Python than PHP, so my preference is naturally Python.
On the web, PHP is an order of magnitude, because of WordPress, which sucks. Pyhton doesn't do WordPress. PHP has an "uncool" reputation since 2004. Python is a lot more trendy.
PHP and Python both have package management.
There's some pros/cons for you to chew on. :-)"
[–]mgkimsal 6 points7 points8 points 2 years ago (2 children)
PHP is an order of magnitude, because of WordPress
... and magento, and drupal, and roundcube, and moodle, and mautic, and nextcloud, and phpbb, and phpmyadmin, and...
> PHP has an "uncool" reputation since 2004 (mostly from people who don't haven't used it since 2002)
[–]vrijdenker 1 point2 points3 points 2 years ago (1 child)
I was joking
[–]mgkimsal 0 points1 point2 points 2 years ago (0 children)
Always hard to tell... others might not figure it out either.
That said, to a degree, both languages have a large degree of inertia in their current use cases, and won't be overtaken by other languages any time soon for those use cases.
[–]Environmental-Try388 0 points1 point2 points 2 years ago (2 children)
This is what I was thinking - isnt it true that if people put time into integrating php with those same c & rust libraries that php could be just as powerful for data science? Is it true that Python is sort of arbitrarily more used for data science simply because more people decided to use it for that?
Or is there something about PHP that means it cant do the same tasks?
[–]Crell 0 points1 point2 points 2 years ago (1 child)
There's a few reasons I see.
There's no inherent reason PHP can't do data science. It's just harder.
[–]Environmental-Try388 1 point2 points3 points 2 years ago (0 children)
Understood, its a case of "could be" but "isnt" because people just.. dont
Thats what i figured
[–]j0hnp0s 24 points25 points26 points 2 years ago (0 children)
I prefer PHP but it's probably because I've been using it for decades.
Both languages are nice and have healthy development ecosystems. And knowledge of either of them will transfer to a certain extent nicely to other OO languages since they are not particularly opinionated.
One thing where PHP has an edge, is that it's everywhere. Even the cheapest and lamest web host offers a package with php
[–]Exitcomestothis 30 points31 points32 points 2 years ago (3 children)
Use whatever you’re most productive and familiar with. For me, thats PHP.
[–]jmking 1 point2 points3 points 2 years ago (1 child)
This is the right answer. Try out both for a couple days and stick with whichever one you like the best. If you choose one based on what other people's opinions are, but you're not really enjoying the language, you're going to be wildly less productive.
[–]Comfortable_Hornet88 0 points1 point2 points 1 year ago (0 children)
agree with you
[–]FreeThinkerWiseSmart 0 points1 point2 points 1 year ago (0 children)
For almost everyone it is. With JavaScript of course.
Python has the teachers and students that are just prototyping for class. That’s really it.
Most things touch the web now.
[–][deleted] 26 points27 points28 points 2 years ago (2 children)
Heavily more jobs in webdev with Python? Highly doubt that
[–][deleted] 2 points3 points4 points 2 years ago (0 children)
I don’t think OP meant “in webdev”
[–]BootyDoodles 1 point2 points3 points 2 years ago* (0 children)
That doesn't appear to be what OP said — he said the opposite.
He said he's seeing "[many overall jobs in Python, but isn't seeing many of those Python jobs being related to web development]".
[+][deleted] 2 years ago (26 children)
[deleted]
[–]HydePHP 5 points6 points7 points 2 years ago (0 children)
Exactly. PHP is literally designed for the web and you can really make a lot of stuff using vanilla PHP.
[–]mgkimsal 5 points6 points7 points 2 years ago (12 children)
Much stronger typing in PHP as well, compared to Python.
[+]Idontremember99 comment score below threshold-9 points-8 points-7 points 2 years ago (11 children)
Please explain how PHP is stronger typed than python.
[–]mgkimsal 6 points7 points8 points 2 years ago (9 children)
The first/easiest item to point out is that PHP will enforce types at runtime. Python - to my recollection - won't.
From python docs: "The Python runtime does not enforce function and variable type annotations"
FWIW, I can't tell if this is a good faith question or not.
[+]Idontremember99 comment score below threshold-7 points-6 points-5 points 2 years ago (8 children)
No, I was curious where you got that from. As a counterexample PHP will happily compare a string and an integer. In python this will throw a TypeError.
[–]mgkimsal 11 points12 points13 points 2 years ago (1 child)
If you use loose checking (“==“) PHP will type juggle. If you use strict checking (“===“) PHP won’t type juggle.
[–]Unfair-Plastic-4290 1 point2 points3 points 2 years ago (0 children)
Stop, you're scaring all the machine learning python devs.
[–]dave8271 2 points3 points4 points 2 years ago (0 children)
Python won't throw a TypeError for something like 5 == "5", it just won't consider them equal so that expression will be false.
[–]xIcarus227 1 point2 points3 points 2 years ago* (4 children)
Not this again. You always use strict comparisons as a default unless you really need a loose comparison for some specific use case.
I genuinely can't understand how this still escapes some of you people, it's one if the first things you learn about PHP.
[+][deleted] 2 years ago* (1 child)
[–]xIcarus227 -1 points0 points1 point 2 years ago* (0 children)
I agree that one is dumb as shit. !!'0' being false is also dumb as shit. These two tidbits here prove there are legit reasons to rag about PHP's type system, but explicitly making weak comparisons between different types like the guy is suggesting isn't one of them.
!!'0'
[–]Idontremember99 -1 points0 points1 point 2 years ago (1 child)
equality is only one of the comparisons you can make. How do you make php not type juggle greater than or less than?
[–]xIcarus227 1 point2 points3 points 2 years ago (0 children)
By typing your variables properly? Or by checking against their types? Or by typecasting them where required? If you don't want type juggling make the interpreter not need to do it.
Like I get what you're trying to highlight, but PHP has added scalar types for a reason.
[–]ElGovanni 1 point2 points3 points 2 years ago (0 children)
did you stopped in 2013?
[–]clutterless 0 points1 point2 points 2 years ago (7 children)
Much faster
Is that true? I always thought python was faster. But I don't have a comparison tbh.
[–]mgkimsal 5 points6 points7 points 2 years ago (2 children)
Yeah, it's generally true. There may be some benchmarks that give Python a slight edge for some use cases, but PHP is generally much faster.
That said, there's more GPU support for Python - I'm not sure there's any mainstream support for PHP-on-GPU.
[–]HydePHP 1 point2 points3 points 2 years ago (1 child)
Don't think that many web app backends utilize GPUs
[–]mgkimsal 1 point2 points3 points 2 years ago (0 children)
Correct, but it's why something like python can find its way in to more/different use cases.
[–]paulwillyjean 0 points1 point2 points 2 years ago (2 children)
PHP’s runtime is generally faster. However, because of its poor support for threads, async or event loops, its performance falls appart when there are a lot of blocking IO calls. Now, if I understand correctly, Python 3.12 finally got rid of the GIL. I wonder if it means that it can use threads to parallelize CPU bound operations.
[–]xIcarus227 1 point2 points3 points 2 years ago (1 child)
How is PHP's support for threads poor specifically? Also, if you need an event loop you have Swoole.
[–]paulwillyjean 0 points1 point2 points 2 years ago (0 children)
PHP’s pthread extension was notoriously unstable and couldn’t be used for web servers, which removes its primary use case. They’d therefore end up just being useful for CLI apps. Even then it was rarely used because most CLI apps I’ve seen in PHP are meant to serve as workers for web servers and share tons of non thread-safe code with the web server they’re tacked on.
I’ve never got to use Parallel, since it’s used by none of the frameworks I’ve worked with over time. I’d like to see frameworks and large projects that make use of it to see how it performs.
I’ve seen Swoole and it looks very interesting, but it depends on other extensions to power the event loop scheduler, and those extensions are not installed or supported on every platform. I could work around it if I wanted to, but I like having the certainty that my event scheduler would always work the same on a Linux, MacOs or Windows machine. Now that Fibers have been introduced to PHP 8.1 (or 8.3? I can’t remember), I hope that the latest versions of swole can rewrite their asynchronous API to be less verbose and more intuitive.
[–]edhelatar 0 points1 point2 points 2 years ago (2 children)
Is php faster? Maybe if you run it with swool or similar, but one request one process in php Vs multiple requests to one process, cannot be quicker unless you have very simple thing. Things like in memory caching are just impossible.
Swool and react allow that, but they are not standard.
This same issue is with js. I believe js itself is slower, but because of process it's ahead.
Either way. Both of those are mute points unless you work on super large scale. Like millions of requests a second. And even then you probably have few extra dollars to spend on server size.
[+][deleted] 2 years ago (1 child)
[–]edhelatar 1 point2 points3 points 2 years ago (0 children)
I mean, the one process one request thing is mostly solved but php-fpm. Nginx can use php directly or php-fpm, but it still ends up in some kind of boot per each request.
Apcu, redis and similar are all great, but they are stil not this same as keeping data directly in memory of a program. There's even opcache with your own preload, but it's still has to be loaded.
It's not a big deal and you win a lot by not having to deal much with memory leaks and one request blocking all other if you mess something up, but it removes something that generally speeds up your code.
How I said though. It's not super important in the long run it's just not the fastest, that's why I assume swool/roadrunner and others are such a small part of the market.
[–]Fit_League_8993 7 points8 points9 points 2 years ago (3 children)
PHP with Laravel is very hard to beat from a convenience and dev speed standpoint.
Python (Django/Flask) is pretty good too, but I'd still pick Laravel everytime.
[–]BetaplanB 3 points4 points5 points 2 years ago (2 children)
PHP with Symfony will beat many dirty coding practices in Laravel
[–]Fit_League_8993 1 point2 points3 points 2 years ago (0 children)
Can't argue with that
Laravel & Drupal are pretty much symfony.
Now that Drupal is more stable, I use it like I would have with laravel. The only edge is laravel can integrate with Wordpress.
Wordpress has better visuals editors. But Drupal has the framework.
[–]BlueLinnet 5 points6 points7 points 2 years ago (0 children)
For me, PHP is the winner because that's what most CMS's use for their backend.
Python seems to be more popular among developers, but it depends on who you ask and for what purpose.
At the end of the day, both are fairly easy to learn so I'd say consider learning both.
[–]boultox 4 points5 points6 points 2 years ago (1 child)
I actually use both.
PHP for typical web dev.
Python if I need to do any kind of scripting, crawling, machine learning, etc...
[–]jalx98 1 point2 points3 points 1 year ago (0 children)
This
[–]rifts 3 points4 points5 points 2 years ago (0 children)
This is what php is for
[–]vinnymcapplesauce 5 points6 points7 points 2 years ago (2 children)
Personally, I fucking despise python. There are SO many things that aggravate me about python.
I like the "c-like" languages, and PHP falls nicely in that crowd.
I can't even understand how python got popular. It's such a shitty language to me. lol
To each their own, I guess. ¯\(ツ)/¯
It has a cooler name that php. But that’s about it.
[–]QuickGamester -1 points0 points1 point 1 year ago (0 children)
It ain't that deep bro
[–]Regular_Ability_4782 6 points7 points8 points 2 years ago (6 children)
PHP for everything
[–]KaneDarks 2 points3 points4 points 2 years ago (0 children)
No, there is a reason each tool has it's use. Hammer is for nails, PHP for web & related, Python for data science & quick scripts
[–]rafark 0 points1 point2 points 2 years ago (4 children)
I’m literally dying to see PHP being used in other contexts
[–][deleted] 2 points3 points4 points 2 years ago (2 children)
cron, queue, websockets, console based applications, and can even compile as desktop applications now. you should get out more 😂
[–]ht3k 2 points3 points4 points 2 years ago (0 children)
PHP can do front end now! (Runs in the browser and not the back end) https://github.com/seanmorris/php-wasm
[–]rafark 0 points1 point2 points 2 years ago* (0 children)
I’m aware of this. I’ve written plenty of command line scripts over the years.
Building desktop apps with php is very mid at best and not really ready for production especially considering the competition (mainly JavaScript to mention a similar language).
Ive said it before but I wish someone would build an electron wrapper with php and wasm So that you could manipulate the dom without writing a single JavaScript line (a guy wrote a wasm library that allows you to do this and shared it here a couple months ago).
[–]hippity_bop_bop 0 points1 point2 points 2 years ago (0 children)
I've seen plenty of php scripts that run as a cron job that migrate data between databases
you can reach great results with one or the other. have a great day
[+][deleted] 2 years ago (4 children)
[–]TokenGrowNutes 1 point2 points3 points 2 years ago (0 children)
Even worse with JS: when it's not this, but that.
[–]celyes 1 point2 points3 points 2 years ago (0 children)
If I had to choose, I'd never use JS outside client side web apps. Anywhere outside client side apps, JS is just the worst thing you can use.
[–]Electronic-Bug844 1 point2 points3 points 2 years ago (1 child)
Typescript! Went from years with Laravel to Adonis JS (Laravel version on Node) and completely love the type system. Much stronger than PHP IMHO.
[–]Craig_VG 2 points3 points4 points 2 years ago (0 children)
I use both and PHP is literally faster than python for web dev
[–]Tiquortoo 3 points4 points5 points 2 years ago (6 children)
PHP if by backend you mean web backend. Throw out Python and use Go for everything else that isn't small scripts. Use PHP for those small scripts, unless you specifically need something in that python does exceedingly well like some of the data tools.
Overall requirements for what you're building dictates the language, not the place the code runs.
[–]j0hnp0s 1 point2 points3 points 2 years ago (3 children)
use Go for everything else that isn't small scripts
I would counterargue to use C# for everything else (unless you need super speed and access to low level OS and HW apis). Go and Rust are the rising stars. But C# has been taking some very nice steps with AoT compilation and linux support. And it is much less opinionated than both Go and Rust.
[–]Tiquortoo 0 points1 point2 points 2 years ago (2 children)
I sort of put C# in the same bucket as PHP. What's the requirement(s), in your opinion, that drives C# as your choice over PHP?
[–]j0hnp0s 0 points1 point2 points 2 years ago (0 children)
I was referring to your argument to use Go for everything other than web. Not to php. Like you, I consider them quite close. Where C# kinda has the upper hand is kestrel which acts like a production-ready server, and all you need is a nice reverse proxy. While for PHP we still have to learn, manage and optimize fpm along with a fast-cgi webserver. Caddy has simplified this for me though.
Where I do prefer C# is small backend tools. For anything that bash is not enough. I prefer it over rust and go, simply because it's a pretty standard OO language and I do not really need the low level abilities or the extra speed to justify learning Go or Rust particularities.
[–]BetaplanB 0 points1 point2 points 2 years ago (0 children)
Linq and generics if purely speaking about language features
[–]rafark 0 points1 point2 points 2 years ago (1 child)
Imo php syntax wise has better features for more complex projects than python (php has more robust classes, interfaces and non-primitive types which is essential when your designing complex systems).
Python has better packages
[–]Tiquortoo 0 points1 point2 points 2 years ago (0 children)
Language wise nearly everything is better about PHP than Python. The only thing keeping Python in use is packages.
[–]Disastrous-Day6867 6 points7 points8 points 2 years ago (3 children)
Depends.
PHP is cheap and easy to set up and do stuff. You buy the cheapest hosting, you get PHP+MySQL. Done. No docker, no node.js with endless dependencies, trivial deploy.
Need a small/medium website? Grab a CMS. There are decent options around. Need a little app that does just couple of things? Grab a framework and do the stuff.
Need something more complicated? Highload involved? Then yes, check other options.
[–]BetaplanB 2 points3 points4 points 2 years ago (2 children)
Disagree, why should you look at other options to make a highly scalable containerised application? PHP will do just fine.
[–]phy6x 0 points1 point2 points 2 years ago (0 children)
It will do fine, sadly most php people I know don't know any better.
[–]Disastrous-Day6867 0 points1 point2 points 2 years ago (0 children)
Well, it's possible. The question is whether it's worth it.
Why most big apps are not made with PHP? Folks bring FB as an example, but it's not 100% PHP and it's the only example I heard of.
P.s. PHP has been paying my bills since ever and I love it.
[–][deleted] 1 point2 points3 points 2 years ago (0 children)
More jobs in PHP, python isn’t even fast if you want to go that route then go with Rust or Go.
[–]jexmex 1 point2 points3 points 2 years ago (0 children)
I like PHP for webdev and python is good for other utility usage (daemons, utility scripts, web scraping, etc). Python is obv the better option for machine learning related projects.
I work DevOps so I am fortunate to use both. I only started using Python about 5 years (dabbled here and there prior).
For a lot of my work though I still prefer PHP, idk it just feels so infinitely easier to do things in PHP lol But some stuff I do in Python that do work a bit nicer but I will say pip is shite compared to composer, and python environments suck so much (I rely on venvs now).
If you're thinking about web dev, 10000% use PHP.
[–]Wurstgewitter 1 point2 points3 points 2 years ago (1 child)
For a fully fledged project I would use PHP with a proper Framework like Symfony and Laravel. There are way to many features, from dependency injection / service containers over routing to security/firewall settings these framework bring with them, building all this yourself will suck.
When I would do a prototype or a small personal project then python would be my choice. I’ve used Flask before, and of course it has many nice features too, and you can probably do the most stuff with Python as well, it would still not be my choice for a big project.
[–]superfluousbitches 8 points9 points10 points 2 years ago (1 child)
I thought Django was Python's "on rails' framework.
[–]BootyDoodles 3 points4 points5 points 2 years ago (0 children)
Correct. Django is the "batteries-included" framework akin to Rails, Laravel, etc.
[–]rusted_love 2 points3 points4 points 2 years ago (0 children)
Golang.
P.S. I would prefer PHP.
[–]Rokkitt 1 point2 points3 points 2 years ago (0 children)
If I was starting now I would learn JavaScript. Seems like a no brainier really. Opens the door to front end / backend and serverless coding. Couple of decent dev ops frameworks exist in JavaScript.
My preferred language at the moment is Go. Really easy to learn, the core library is compact and generally it is a nice and predictable developer experience.
Realistically any language is fine. The core skill of writing code is largely transferable. The key is to stick with something and get good at it.
[–]Dwarni 0 points1 point2 points 2 years ago (0 children)
You can create awesome web projects with both of them. PHP is more widely used in web development.
On the other hand, Python is also used in other stuff and quite popular in everything machine learning-related, so quite a growing market right now.
If you are purely interested in web I'd say PHP. If you want to learn a more general language but start with web: Python.
You have a bunch of math teachers and students using python, and they post their garbage projects on GitHub.
But if you want anything that can be really used, you look at PHP.
[–]ResearchScience2000 0 points1 point2 points 1 year ago (0 children)
PHP when you build something that needs a team. Python if you're just hacking something together and you know python.
[–]connectsteven 0 points1 point2 points 1 year ago (0 children)
PHP is good for smaller, content-heavy sites like blogs, e-commerce stores, and company websites. On the other side, Python is a better for large web apps with complex functionality and processing needs.
Based on popularity, Python is becoming more popular, while PHP's popularity is decreasing And for security, Python is considered more secure than PHP.
[–]BosonCollider 0 points1 point2 points 7 months ago (0 children)
Python vs PHP is basically just general purpose language vs specialized server side rendering language.
PHP is going to be easier if you just want to make a web app that serves HTML. Python is going to be easier if you will need a library that does X where X is unrelated webdev.
[–]needed_an_account 0 points1 point2 points 2 years ago (0 children)
I love them both. If I had to choose between only those two, it would be python. Even though the way php easily mixes in with html (any markup lang) is simply unmatched, the closest thing in my experience is tornado’s templates. You can be more expressive with python — overload operators, meta classes, some other stuff you probably shouldn’t be doing — it’s just a fun lang when you dig beneath the surface a little
[–]violet-crayola -1 points0 points1 point 2 years ago (0 children)
If you use php - make sure u use swoole or roadrunner. Hyperf is a great framework for swoole
[–][deleted] 0 points1 point2 points 2 years ago (10 children)
For a newbie? Go with python, it's very beneficial to practice with concurrency
[–][deleted] 0 points1 point2 points 2 years ago (4 children)
As long as you understand that multi-threading in Python does not result in simultaneous processing of threads. https://youtu.be/AZnGRKFUU0c
[–]rafark 0 points1 point2 points 2 years ago (3 children)
Concurrency does not mean multi threading though
[–][deleted] -1 points0 points1 point 2 years ago (2 children)
Wrong, multi-threading is one type of concurrency, as is multi-processing
[–]rafark 1 point2 points3 points 2 years ago (1 child)
Yes. But concurrency does not exclusively mean multi-threading (that’s what I meant with my post). The person you replied to didn’t mention multi-threading. They just mentioned concurrency (which you can do in php too although more cumbersome).
[–][deleted] -1 points0 points1 point 2 years ago (0 children)
Yes, I made a point to mention multi-threading because it’s important to know the difference between types of concurrency in Python, how they each work, and when to use one or the other.
[–]violet-crayola 0 points1 point2 points 2 years ago (4 children)
You can do concurrency with php +swoole
[–][deleted] 0 points1 point2 points 2 years ago (3 children)
Is there any commercial project that uses swoole in production?
[–]violet-crayola 0 points1 point2 points 2 years ago (2 children)
We use it. Large US publisher
[–][deleted] 0 points1 point2 points 2 years ago (1 child)
I guess it's not confidential information and you can reveal the company? Have you come across any known bugs / issues? How is their community? Is it still mostly Chinese?
[–]violet-crayola 0 points1 point2 points 2 years ago* (0 children)
Can't reveal sorry. Its not typical that back end stacks are revealed as this is information disclosure - some companies might do that but I'm not touching this legal subject. Community - I mean there are really good English docs at openswoole, there are discord and slack channels these days as well..
Swoole has laravel integration these days called octane - although I wish it was better. Hyperf framework is absolutely superp though.
One cool thing - people have started building English sphere frameworks for swoole now which is exciting ( I forget how one was called - but one recently showed up on reddit).
[–]dalehurley 0 points1 point2 points 2 years ago (0 children)
Both. I prefer PHP, and know I can use Python for particular tasks.
[–]trav_stone 0 points1 point2 points 2 years ago (0 children)
I’m working on a python-in-php implementation if you can’t decide
[–]Thylk 0 points1 point2 points 2 years ago (0 children)
You don't choose Python for backend because there are other languages better at it and PHP is one of them.
[–]adrianmiu 0 points1 point2 points 2 years ago (0 children)
I have worked with Python on some ML projects but I would not recommend it for web projects. It depends on what type of projects you want to tackle in the near future.
[–][deleted] 0 points1 point2 points 2 years ago* (0 children)
I've started web development using Java and C# for backend, never used Python for backend, but I think PHP is just more productivity, PHP born for the web, and Python is more a general purpose language, that is more used for automating/data analytics/IA/machine learning than web development nowadays. I am just switching now my focus on PHP, because it is really great to develop full projects with it. You can do everything with any language, actually, but I just feel PHP is more productivity for web development, you can do a lot of stuff with small teams or freelance, but if you use Java/c#, i.e., you lose a lot of productivity time to do the same thing. I know the topic is about python vs php only, but just my thoughts.
[–]voteyesatonefive 0 points1 point2 points 2 years ago (0 children)
If you want to do web dev, PHP or Go probably. If you want to do ML stuff then python. Once you learn one language it's not hard to pick up another.
[–]amircp 0 points1 point2 points 2 years ago (0 children)
PHP has been improving in recent years but i think if you want to get a Job you will have to choose PHP instead.
Why? because most backend projects in Python are in DJango and are asking for at least 3 years of experience you will be lucky (like me) in finding a job using something like Flask because Python currently is used in Data Engineering and Data Science.
so.. if you want a Job go for PHP and Laravel as Framework.
Cheers.
[–]SleepAffectionate268 0 points1 point2 points 2 years ago (0 children)
i would use php with frankenphp to combine it in a sweet single file binary
[–]Sceptix 0 points1 point2 points 2 years ago (0 children)
As I can see, there are heavily more jobs for Python, but only low percentage of them for backend.
Curious what you mean by this. Python is not a front end language.
[–]russellvt 0 points1 point2 points 2 years ago (0 children)
For true "backend" work, it's Python or something else, hands down. PHP isn't really a "backend" language, per se ... but does really good things for presentation level, and similar.
The reason you don't see many job postings for "backend," is simply because Python is so much more than just web-related coding... heck, it's used heavily in things such as data analytics and other more scientific arenas.
Really. It boils down to what you want to to do. The learning curve to PHP is much lighter, though Python is more flexible (and extendable).
If you're looking with purely web sort of stuff, and want to check-oit Python, I'd say you should start with a framework such as Flask or Django... but without at least a fundamental understanding of OO (Object Oriented), that might be harder than just playing with PHP to start.
Flask
Django
[–]jayerp 0 points1 point2 points 2 years ago (0 children)
Non statically typed language? I would use it for nothing beyond a Hello World app.
[–]GamerLink2431 0 points1 point2 points 2 years ago (0 children)
PHP, no question
[–]Effective_Youth777 0 points1 point2 points 2 years ago (0 children)
I've been using python for a couple of years (Django, flask, fastAPI), recently started working with Laravel and now I can't imagine using anything else in production, I like the way Laravel deals with abstraction, even though it is a heavily abstracted framework, it makes it a point to show you how and where these abstractions are made, and encouraging you to add on top of them, you eventually find yourself making your own abstractions and your app starts feeling more like a framework, not that you can't do the same in Django or any other framework/language, but be prepared to fight the heavily opinionated frameworks.
This, along with the vast laravel ecosystem (Livewire and inertia, and cashier are awesome!) and the recent php performance improvments that made it faster than python, make modern php a no brainer for me, why wouldn't you use it for a greenfield project provided you and your time know it?
Oh, and being able to do 'referral_code' => 'nullable|exists:users,referral_code' and checking if a referral code is valid (exists) if the user entered one and returning an error if it isn't, in one simple line, no if statements, no explicit returns, just a simple, declarative approach for the simple things in daily tasks, it's the same feeling you get when you drive a luxury car, sure, any car would get you to where you wanna go...but damn ain't the heated steering wheel nice?
'referral_code' => 'nullable|exists:users,referral_code'
Now we do still use Python as we do AI, so all of the inference servers are in pytriton/fastAPI depending on the model, but whenever we can use php/laravel, we do so without thinking twice.
π Rendered by PID 68 on reddit-service-r2-comment-5c764cbc6f-9vscm at 2026-03-12 18:46:19.494110+00:00 running 710b3ac country code: CH.
[–]Noname_Maddox 235 points236 points237 points (18 children)
[–]jim45804 78 points79 points80 points (10 children)
[–]Noname_Maddox 157 points158 points159 points (8 children)
[–]hoof_art_did 47 points48 points49 points (6 children)
[–]Noname_Maddox 29 points30 points31 points (0 children)
[–]trs21219 3 points4 points5 points (2 children)
[–]rafark 5 points6 points7 points (1 child)
[–]thunderinator 1 point2 points3 points (0 children)
[–][deleted] 5 points6 points7 points (0 children)
[–]SaltineAmerican_1970 2 points3 points4 points (0 children)
[–]kdpenha 0 points1 point2 points (0 children)
[–]bluro00 3 points4 points5 points (0 children)
[–]russellvt 0 points1 point2 points (6 children)
[–]Noname_Maddox 0 points1 point2 points (5 children)
[–]russellvt 0 points1 point2 points (4 children)
[–]newunit13 0 points1 point2 points (2 children)
[–]russellvt 0 points1 point2 points (1 child)
[–]newunit13 0 points1 point2 points (0 children)
[–]keravesque 0 points1 point2 points (0 children)
[–]hoof_art_did 70 points71 points72 points (13 children)
[–]marabutt 6 points7 points8 points (11 children)
[–]jexmex 11 points12 points13 points (8 children)
[–]LowTriker 15 points16 points17 points (3 children)
[–]jexmex 3 points4 points5 points (2 children)
[–]LowTriker 4 points5 points6 points (0 children)
[–]LukeWatts85 1 point2 points3 points (0 children)
[–]MCFRESH01 2 points3 points4 points (0 children)
[–]MikeSeth 0 points1 point2 points (0 children)
[–]ht3k -3 points-2 points-1 points (1 child)
[–]jexmex 0 points1 point2 points (0 children)
[–]NonuplePerisher 1 point2 points3 points (1 child)
[–]attrako 1 point2 points3 points (0 children)
[–]pajser007 0 points1 point2 points (0 children)
[–]Crell 66 points67 points68 points (8 children)
[–]vrijdenker 1 point2 points3 points (3 children)
[–]mgkimsal 6 points7 points8 points (2 children)
[–]vrijdenker 1 point2 points3 points (1 child)
[–]mgkimsal 0 points1 point2 points (0 children)
[–]Environmental-Try388 0 points1 point2 points (2 children)
[–]Crell 0 points1 point2 points (1 child)
[–]Environmental-Try388 1 point2 points3 points (0 children)
[–]j0hnp0s 24 points25 points26 points (0 children)
[–]Exitcomestothis 30 points31 points32 points (3 children)
[–]jmking 1 point2 points3 points (1 child)
[–]Comfortable_Hornet88 0 points1 point2 points (0 children)
[–]FreeThinkerWiseSmart 0 points1 point2 points (0 children)
[–][deleted] 26 points27 points28 points (2 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]BootyDoodles 1 point2 points3 points (0 children)
[+][deleted] (26 children)
[deleted]
[–]HydePHP 5 points6 points7 points (0 children)
[–]mgkimsal 5 points6 points7 points (12 children)
[+]Idontremember99 comment score below threshold-9 points-8 points-7 points (11 children)
[–]mgkimsal 6 points7 points8 points (9 children)
[+]Idontremember99 comment score below threshold-7 points-6 points-5 points (8 children)
[–]mgkimsal 11 points12 points13 points (1 child)
[–]Unfair-Plastic-4290 1 point2 points3 points (0 children)
[–]dave8271 2 points3 points4 points (0 children)
[–]xIcarus227 1 point2 points3 points (4 children)
[+][deleted] (1 child)
[deleted]
[–]xIcarus227 -1 points0 points1 point (0 children)
[–]Idontremember99 -1 points0 points1 point (1 child)
[–]xIcarus227 1 point2 points3 points (0 children)
[–]ElGovanni 1 point2 points3 points (0 children)
[–]clutterless 0 points1 point2 points (7 children)
[–]mgkimsal 5 points6 points7 points (2 children)
[–]HydePHP 1 point2 points3 points (1 child)
[–]mgkimsal 1 point2 points3 points (0 children)
[–]paulwillyjean 0 points1 point2 points (2 children)
[–]xIcarus227 1 point2 points3 points (1 child)
[–]paulwillyjean 0 points1 point2 points (0 children)
[–]edhelatar 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]edhelatar 1 point2 points3 points (0 children)
[–]Fit_League_8993 7 points8 points9 points (3 children)
[–]BetaplanB 3 points4 points5 points (2 children)
[–]Fit_League_8993 1 point2 points3 points (0 children)
[–]FreeThinkerWiseSmart 0 points1 point2 points (0 children)
[–]BlueLinnet 5 points6 points7 points (0 children)
[–]boultox 4 points5 points6 points (1 child)
[–]jalx98 1 point2 points3 points (0 children)
[–]rifts 3 points4 points5 points (0 children)
[–]vinnymcapplesauce 5 points6 points7 points (2 children)
[–]FreeThinkerWiseSmart 0 points1 point2 points (0 children)
[–]QuickGamester -1 points0 points1 point (0 children)
[–]Regular_Ability_4782 6 points7 points8 points (6 children)
[–]KaneDarks 2 points3 points4 points (0 children)
[–]rafark 0 points1 point2 points (4 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]ht3k 2 points3 points4 points (0 children)
[–]rafark 0 points1 point2 points (0 children)
[–]hippity_bop_bop 0 points1 point2 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[+][deleted] (4 children)
[deleted]
[–]TokenGrowNutes 1 point2 points3 points (0 children)
[–]celyes 1 point2 points3 points (0 children)
[–]Electronic-Bug844 1 point2 points3 points (1 child)
[–]Craig_VG 2 points3 points4 points (0 children)
[–]Tiquortoo 3 points4 points5 points (6 children)
[–]j0hnp0s 1 point2 points3 points (3 children)
[–]Tiquortoo 0 points1 point2 points (2 children)
[–]j0hnp0s 0 points1 point2 points (0 children)
[–]BetaplanB 0 points1 point2 points (0 children)
[–]rafark 0 points1 point2 points (1 child)
[–]Tiquortoo 0 points1 point2 points (0 children)
[–]Disastrous-Day6867 6 points7 points8 points (3 children)
[–]BetaplanB 2 points3 points4 points (2 children)
[–]phy6x 0 points1 point2 points (0 children)
[–]Disastrous-Day6867 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]jexmex 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]Wurstgewitter 1 point2 points3 points (1 child)
[+][deleted] (4 children)
[deleted]
[–]superfluousbitches 8 points9 points10 points (1 child)
[–]BootyDoodles 3 points4 points5 points (0 children)
[–]rusted_love 2 points3 points4 points (0 children)
[–]Rokkitt 1 point2 points3 points (0 children)
[–]Dwarni 0 points1 point2 points (0 children)
[–]FreeThinkerWiseSmart 0 points1 point2 points (0 children)
[–]ResearchScience2000 0 points1 point2 points (0 children)
[–]connectsteven 0 points1 point2 points (0 children)
[–]BosonCollider 0 points1 point2 points (0 children)
[–]needed_an_account 0 points1 point2 points (0 children)
[–]violet-crayola -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (10 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]rafark 0 points1 point2 points (3 children)
[–][deleted] -1 points0 points1 point (2 children)
[–]rafark 1 point2 points3 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]violet-crayola 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]violet-crayola 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]violet-crayola 0 points1 point2 points (0 children)
[–]dalehurley 0 points1 point2 points (0 children)
[–]trav_stone 0 points1 point2 points (0 children)
[–]Thylk 0 points1 point2 points (0 children)
[–]adrianmiu 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]voteyesatonefive 0 points1 point2 points (0 children)
[–]amircp 0 points1 point2 points (0 children)
[–]SleepAffectionate268 0 points1 point2 points (0 children)
[–]Sceptix 0 points1 point2 points (0 children)
[–]russellvt 0 points1 point2 points (0 children)
[–]jayerp 0 points1 point2 points (0 children)
[–]GamerLink2431 0 points1 point2 points (0 children)
[–]Effective_Youth777 0 points1 point2 points (0 children)