9 ms·
Learn PHP the Right Way
- pluc 2y ago...why take a title that's already quite famous in the industry? https://phptherightway.com/ https://phptherightway.com/
- djaouen 2y agoThe only reason to learn PHP in 2024 is if you are specifically targeting PHP jobs. Learning PHP is like learning Perl: suboptimal. Edit: Jesu X. Chris, I didn’t mean to start a language war. Learn PHP if you want, I won’t stop you lol
- brightball 2y agoBoth have their uses.
- djaouen 2y agoI am not saying they don’t. I am just saying there are (except in a few rare cases) better uses of your time.
- archerx 2y agoPlease give me some examples!
- djaouen 2y agoLearn a functional language like Elixir. That’ll prove both useful and mind expanding!
- archerx 2y agoHow can I use Elixir for the web, microcontrollers or making games? How can Elixir make the development of those things easier/better?
- ecjhdnc2025 2y agoElixir looks great. It reminds me of the functional and pseudofunctional programming languages I used at uni and their environments like Poplog. I agree it's mind-expanding. But I don't think most web development work is mind-expanding or a realistic application for it. I also don't think using it to criticise PHP is really the right target. If you want to use a functional programming language/environment as a critique of modern web development... maybe start by targeting server-side JS.
- brightball 2y agoUsing Perl for sysadmin work and living life in Regex for a while has its perks too. ;)
- exodust 2y agoAfter learning HTML, CSS and Javascript, PHP is a good next choice on the path to self-learning web development in 2024. The whole idea is to achieve "world is your oyster" with the minimal number of steps. Don't agree? That's fine. Web development isn't meant to be dictated to others.
- ChrisMarshallNY 2y ago> if you are specifically targeting PHP jobs Lot of those around[0]. [0] https://w3techs.com/technologies/history_overview/programming_language/ms/y https://w3techs.com/technologies/history_overview/programmin...
- kristopolous 2y agoThere's certainly a ton of use cases where php is a few minute job and anything else is 10x more or even longer just like is true with shell scripts and perl Snobbery is like saying you're intellectually superior to using a specific screwdriver or kitchen knife.
- forgetfreeman 2y agoOr they're simply committed to using the wrong tools for the job out of some misguided ideology someone else handed them when they were too new to know better.
- archerx 2y agoPHP is so much nicer to use on a webserver vs Python or JS. It’s almost like PHP was built for the web and fits it like a tailored suit! Would I use PHP to make games? No! I wouldn’t use JS or Python for that either. I try to use the best language for the job without letting any cargo cult biases get in the way. Front end stuff? JS! Backend stuff? PHP! AI stuff? Python! Games and microcontrollers? C/C++!
- wiseowise 2y ago> PHP is so much nicer to use on a webserver vs Python or JS. How?
- diggan 2y agoOne thing that I think is under-appreciated from the perspective of "getting shit done" is that the default model of PHP makes it really hard to have memory leaks that eventually crashes your app/server, as your PHP script has a defined "start" and "end" that are all within the request lifecycle. So even if you leak horribly, thanks to Apache/Nginx/Caddy/whatever only launching your script and then your script stops running, it basically doesn't affect you at all. Granted, this is more like a bandage, but it works out great for beginners who just want to create their own personal dynamic homepages, something PHP does great :) Compared to Python or JS where the standard practice is creating a server that runs constantly, and if you leak memory somewhere, your application eventually crashes as you run out of memory.
- cwillu 2y agoBasically, PHP was using arenas before arenas were cool :)
- archerx 2y agoA lot of the vanilla inbuilt functions are very web oriented and if you like C, it feels very similar but much easier.
- bearjaws 2y ago
- patmorgan23 2y agoDisagree. Laravel is a great productive framework and there are actually a lot of high paying PHO jobs
- LoganDark 2y agoPHP is usually the only option for running server-side code on shared/managed hosting. (Either that, or a version of Ruby from 2004. Do you want to use Ruby from 2004?)
- InsideOutSanta 2y agoI think for probably more than half of all websites out there, something like LAMP is either the optimal, or very close to the optimal solution. It's absolutely bonkers to me what kinds of tech stacks people use to render what essentially amounts to a bunch of forms.
- CM30 2y agoAt least half of all websites would probably be better of if their creators realised they needed something closer to a 'blog' than a 'web app'. It's especially true when it comes to the media industry, who seem to love creating the most over engineered SPAs possible for functionality that's barely changed since the 90s.
- bearjaws 2y agoI'd say swap out MySQL but yeah, a CMS is 99% of what you need.
- jim180 2y agoAfter spending many years on Objective-C/Swift, I had a couple of opportunities to work with Django (Python), and then Laravel (PHP). I'd take Laravel with Livewire (and some Alpine.js) over Django any-day. Plus my gut feeling says, that React would be as pleasant as Laravel and co.
- rob 2y agoNot if you're trying to make money and learn Web development. PHP is king. I'd rather get paid $1,000 to build something that takes < 1 day and $50-150/month to maintain something on a $20 VPS using a tried and true Web technology with tons of developer support and a stable ecosystem. I can start a new Laravel project and with a starter kit have 50% of the site done. Auth's already done out of the box. The ecosystem is amazing. The tooling is amazing. WordPress is amazing and its ability to extend itself and build almost anything you want is amazing. I'm moving on to the next client while someone is crying about WordPress' arcane database structure or code and they're still sitting at a text editor with some Haskell code. All I have to do is worry about my project, not create OCD for 2 weeks on the best way to set something up out of 10 different ways. I'm not worrying about which flavor of JavaScript framework is in popularity this week - I'm not worrying about how to deploy my Python app and setting up Kubernetes. I'm not worried about compiling my Elixir project to WASM and deploying to Fly.io to support my 1 visitor a month.
- ChrisMarshallNY 2y ago> I didn’t mean to start a language war. Lot of that going around; especially in venues like this, which has a lot of "Ooh! Shiny!" going on. I tend to be a bit more conservative than many; but not to any kind of extreme degree. I like new stuff, but I also like shipping, which doesn't come from the bleeding edge. Personally, I use PHP on my backend work, mostly because it's a known quantity, and is an industrial-strength, massively-supported system, that is not going anywhere but up. And I don't feel like learning a whole new language and API, just for some relatively minor-scale server work (I spend most of my time, writing native Swift frontends). If it's good enough for PornHub, it's good enough for me. That said, if PHP were, as is often falsely claimed, going away, I'd probably learn something new. I doubt it would be the tip of The Shiny Spear, but it would be a more modern system; maybe Python. I've never actually liked working with PHP, but the same could be said for most languages I've used. I like Swift. As it is, I would still want to learn Laravel, before moving away from PHP. From what I understand, it's a fantastic framework, that makes PHP a much more effective server system.
- lbj 2y ago[flagged]
- archerx 2y agoWow using a 12 year old obsolete article to prove a point, nice. Lets be honest here, the modern web is an over engineered fractal of bad design.
- LoganDark 2y agoAn article is not obsolete just because it's 12 years old. Honestly, in PHP's case, I don't think there's much you can say about it 12 years ago that isn't still true.
- AegirLeet 2y agoAlmost nothing in that article is true for modern versions of PHP. It's definitely obsolete.
- throwaway03254 2y ago12 years ago (2012), the latest PHP version was 5.4. The current version is 8.4. The language has made major changes to both syntax and functionality.
- LoganDark 2y agoEh. On its own that means nothing, the other commenters make better points.
- throwaway03254 2y agoI'm not going to bother explaining something that can be found easily on Google.
- logifail 2y ago> That article is not obsolete just because it's 12 years old. Honestly, in PHP's case, there's not much you can say about it 12 years ago that isn't still true. The very first specific thing mentioned in the article is "mysql_real_escape_string". The mysql_ extension was deprecated in PHP 5.5.0 (released on 20 June 2013) and fully removed in PHP 7.0.0 (released on 3 December 2015).
- muglug 2y agoPassively watching YouTube is probably not the right way to learn any progamming language.
- frabert 2y agoAnecdotal at best, but that is essentially the way I learned English, and definitely the reason I think I don't have a distracting accent when talking in English.
- muglug 2y agoEdited to specify I'm talking about programming languages...
- ocodo 2y agoI'd say it depends: - Depends on stage of study - Depends on type of concept - Depends on how the student learns the most effectively. There's only one way I think your statement is true, and that's if you add "solely".
- calvinmorrison 2y agoPHP in 2024 is really nice. It's come a long way but is still very rock steady.
- hu3 2y agoThis playlist is a great overview. I watched it myself and learned a thing or two despite also working with PHP professionally for years. Highly recommend to also stop after each video and try to implement a quick example of what it is teaching.
- cletus 2y agoIt's disappointing that PHP still gets hate in 2024. PHP of 2024 isn't the PHP of 2004. As someone with a bunch of experience in Java, C, C++, Python, PHP, Hack, Javascript and a handful of others, PHP is (IMHO) almost a perfect language for serving HTTP requests because of these characteristics: 1. Essentially an HTML document is a valid PHP program. This is an excellent starting point for beginners; 2. PHP has a stateless API that means there's basically zero start up cost, unlike, say, loading libraries like you do in Java or even Python; 3. There's no threading within the context of a request. This is what you want 99.99% of the time. Hack extended this with cooperative async/await; 4. Because of (3) everything you allocate/use within a request context just gets thrown away. There's no persistent state (eg like Java's servlet model). Again, this is almost ideal; 5. Because of all the above, PHP hosting is incredibly cheap and accessible. The two things I'd probably add to PHP come from Hack: a modern type system with nullable support and the collections (vec, map, set).
- teqsun 2y agoHonestly speaking, the main thing that always made me dislike PHP was lots of things related to the syntax. Call it petty, but it's the truth. I've always felt that PHP could greatly benefit from a Kotlin-esque interop language with a more modern syntax and QoL upgrades, but I'm not sure if the juice is really worth the squeeze.
- citrin_ru 2y agoIMHO most of hate is just because it is fashionable to hate some languages including PHP and Perl. But there is some criticism which looks valid to me e. g. [1] Regarding embedded into HTML PHP code - it's a easy for beginners but in a large application it leads to hard to maintain mix of app logic and presentation - AFAIK this feature is rarely used outside toy project for many years. [1] https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ (very old and some issues may be were addressed but it's hard to fix all of this without creating an incompatible language)
- 9dev 2y agoEmbedding PHP in HTML is often treated as a kind of dirty legacy we don’t talk about, even though is actually an amazing prototyping feature. As long as you use it like you would use Jupyter notebooks, you’re golden.
- Alifatisk 2y agoTake me back to the LAMP stack days, good times
- replwoacause 2y agoI like PHP, and guess what? I also like PowerShell for web apps. I don't really care what anybody says—I can build fast in PowerShell. My clients are happy, it's simple to debug, and I can tap into .NET classes when necessary. PowerShell + HTML + Alpine = productivity. I'm not building the next Netflix or Amazon and the end-user isn't going to notice or care that I haven't selected Node and React. I just can't get behind the complexity of build steps and compiling, all just to get a website online. It's crazy. The simplicity that PowerShell (and PHP) bring to this process can't be overlooked... so I like to beat on this drum whenever I get the chance. Choose the tool that is right for the job, and PHP can be that tool in a surprising number of cases.
- mats852 2y agoI really learned to appreciate what Powershell is after listening to @adamgordonbell CoRecursive episode with Jeffrey Snover (https://corecursive.com/building-powershell-with-jeffrey-snover/ https://corecursive.com/building-powershell-with-jeffrey-sno...). I really loved PHP, but now with go+templ (https://templ.guide https://templ.guide) I personally don't have a use-case for PHP anymore, but that doesn't mean it's irrelevant for the world.
- throwitaway1123 2y ago> I really loved PHP, but now with go+templ (https://templ.guide https://templ.guide) I personally don't have a use-case for PHP anymore, but that doesn't mean it's irrelevant for the world. This is the first time I've heard of Templ. It looks cool and it was really easy to set up. Apparently there are IDE extensions to enable syntax highlighting and HTML auto-completion, but is there a way to type check the templates? One of the things I love about JSX as a templating language is that errors in your markup get reported as type errors [1]. If I write `<a herf="/foo">` instead of `<a href="/foo">` and run `tsc --noEmit --watch`, TypeScript will complain until I fix the issue. You can even extend the types to support your own HTML custom elements. JSX is a first class citizen in TS (and by extension any editor or IDE with support for TS). [1] https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/vhtml/index.d.ts https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast...