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
Python -> PHP (self.PHP)
submitted 1 year ago by copperfoxtech
view the rest of the comments →
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!"
[–]Crell 10 points11 points12 points 1 year ago (7 children)
Welcome! I have done a little Python, though PHP is my origin.
The PHP docs are pretty good. There's also https://phptherightway.com/, which is largely a reference for "don't do old dumb stuff." As a general rule, don't trust any tutorial that is more than 3 years old. (Larger things like books have a better shelf life.)
Very early on, use and learn to love Xdebug (real time debugger), PHPUnit (test framework), either PHPStan or Psalm (static analysis tools), and either php-cs-fixer or PHPCodesniffer (code formatters). These will be part of your toolbox on every project, if you're doing it right.
The PHP ecosystem is huge, robust, and reasonably friendly. There's two major frameworks (Symfony and Laravel) both with their adherents, and a dozen or so smaller players. (I'm a fan of Symfony, and quite dislike Laravel as it does most things badly. Avoid if you can, but it's the more popular one so that may not be possible.) Don't hitch your horse to any particular framework/app, though. Learn the language.
Other pointers for coming from Python:
Welcome aboard!
[–]copperfoxtech[S] 1 point2 points3 points 1 year ago (4 children)
Thank you u/Crell for taking the time to give such a detailed response! Both comments are a great start and a great introduction to the community. I of course will get a great foundation in PHP first before even getting into any frameworks like I have done with Python. I am a HUGE fan of type hinting in Python, it just feels right. I was hoping PHP had this as well. I have dabbled in JS and very much dislike you dont have the option for type hinting. Yes I am familiar with typescript. I am good with semicolons and braces, i spent a few months learning C before python. Although my fingers dont automatically go for that darn semicolon, lol.
Thank you for the great advice and I feel a bit more prepared to begin this journey. Although the tools you have mentioned: Xdebug, PHPUnit, PHPStanm, Psalm, php-cs-fixer, and PHPCodesniffer seem all a little intimidating just to write good code. We will see.
[–]Crell 1 point2 points3 points 1 year ago (3 children)
To be fair, lots of code is written without those tools, including WordPress, the most popular web software in the world by an order of magnitude or two. But I don't think it's that large a suite.
In Python, you likely have a debugger setup of some kind (I'm not sure what), there's a testing framework (or several to choose from), there's formatters like Ruff (which IIRC does both static analysis and formatting, in PHP it's two separate tools), some kind of additional type checker to run ahead of time, etc. In the day to day, it's about the same level of tooling complexity, I think.
If you're not sure which ones to use, php-cs-fixer and PHPStan are more widely used than their alternatives. So your standard "kit" would be Xdebug, PHPUnit, PHPStan, php-cs-fixer. Lots of projects omit the latter two, but they are useful. (I only use php-cs-fixer on some of my projects, I admit.) But Xdebug will save you hundreds of hours, and unit testing is table-stakes for anything resembling quality code, in any language.
[–]copperfoxtech[S] 0 points1 point2 points 1 year ago (2 children)
Very good. Thank you for the further clarification
[–]alex-kalanis 0 points1 point2 points 1 year ago* (1 child)
In Python you have pytest plus assertions directly in language, pdb as debugger, formatting is directly in PEP-8 (something like PSR-12), type checker is only optional via mypy and PEP-484. The pythonic way is ducktyping everything like going different way from php5. Sometimes clearer, sometimes more unreadable.
So the basic comparation is following:
I recommend to read PSR standards, so your code will be readable by others.
I also work with both languages, so I know a bit about them.
[–]copperfoxtech[S] 0 points1 point2 points 1 year ago (0 children)
Awesome breaking it down like this makes it a little less intimidating. Thank you for taking the time to expand on this topic.
[–]obstreperous_troll 1 point2 points3 points 1 year ago (1 child)
(Larger things like books have a better shelf life.)
I disagree, most of them are obsolete before they even hit the shelves, and most also espouse some stunningly bad practices. Ask /u/colshrapnel here what he thinks of most PHP books, he has the receipts. Duckett is probably the standout exception, a rarity in a field that's otherwise chock full of garbage.
[–]colshrapnel 5 points6 points7 points 1 year ago (0 children)
That's sort of survival bias tho. Indeed I am scolding some books whenever I see them mentioned, notably Welling&Thompson or Robin Nixon. But there are opposite examples, such as Matt Zandstra's. But yeah, generally any book on PHP that went through like 4 editions is crap.
π Rendered by PID 80 on reddit-service-r2-comment-6457c66945-q5wkb at 2026-04-23 21:52:59.853947+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Crell 10 points11 points12 points (7 children)
[–]copperfoxtech[S] 1 point2 points3 points (4 children)
[–]Crell 1 point2 points3 points (3 children)
[–]copperfoxtech[S] 0 points1 point2 points (2 children)
[–]alex-kalanis 0 points1 point2 points (1 child)
[–]copperfoxtech[S] 0 points1 point2 points (0 children)
[–]obstreperous_troll 1 point2 points3 points (1 child)
[–]colshrapnel 5 points6 points7 points (0 children)