7 Pros and Cons of learning PHP. Should you learn PHP in 2021?

Some web developers really despise PHP and that’s fine everyone is different everyone is entitled to their opinion I happen to really like PHP for for small and medium sized applications and websites as long as the code is written correctly now with that said what I want to do in this video is not try and sway those people into liking or using PHP but just to take a look at the facts of what PHP is and what it isn’t and then you can make that decision on your own and I’m not here to say PHP is the best server-side language out there because I don’t think that in fact I think it’s stupid and closed-minded to say anything is the best or the worst everyone’s different and everyone has their own abilities and their own opinions and they adapt a certain syntax in a different way that’s why I can’t stand when someone says this is the best and that’s the worst because I said so that pisses me off it just makes you look arrogant ignorant but anyways I’m not going to go off into a negative rant so most likely you’re here because you’re probably wondering what server-side language you should learn first or second or third now if you were to ask my opinion I would narrow it down to either PHP nodejs or Python all right I’m actually very new to Python I’ve been working with Django recently and I do really like it if you ask me a few months ago I would have said rails instead of Python but rails has really seen two level off recently and I absolutely love nodejs so node may be an attractive choice because chances are you already know some JavaScript so the logical choice would be to go with node but I would actually look from a different angle and look at it as choosing something that’s not JavaScript gives you a little bit of experience with a secondary language so you can kind of look at that look at what’s similar and what’s different between the two and then you can start to look at other languages and compare those and just start to get a better idea of how programming works in general so I don’t really have a clear recommendation aside from looking at those three no PHP and Python I don’t know enough about most of these other languages aside from just the basics I wouldn’t recommend Java or C++ or anything like that for your first language not because they’re not good they’re extremely powerful but because they’re just too difficult and too strict for a beginner alright now what I actually did was just like I said I learned HTML CSS and basic JavaScript and then went to PHP I worked with that for a long time I learned a bunch of frameworks and then I went back to JavaScript and learned nodejs Express and a bunch of client-side frameworks like angular and react then rails and now Python so that’s what I did and I don’t regret any of those decisions I’ve done pretty well with those and I can pick up languages very quickly now all right so that those are pretty much your choices so let’s take a look at some of the advantages of PHP so I think one of the biggest reasons to learn PHP is because it’s absolutely everywhere love it or hate it around 35 percent or so of the web sites on the Internet use PHP in one form or another it may even be higher than that I’m not really sure WordPress is actually a big chunk of that which is the most popular content management system or blog platform by far now with that said PHP is a great language to learn if you’re looking for a job I’m not saying it’s the best but it is up there there’s a ton of web design and development firms out there that use WordPress or even Joomla or Drupal and these are the most popular content management systems and web design companies love these because it enables their clients to update their own content instead of bugging them to do it now of course you could create your own content management system in any language but you can roll out a wordpress site in a week especially if you’re using pre-made plugins and templates so PHP is also incredibly easy to learn when you compare it to language like Java or C++ this is a big advantage but it can also be a disadvantage and I’ll tell you why in a little bit so support is another big advantage PHP has a huge community and if you get stuck there’s a really good chance you can find a fix for your exact problem most developers know PHP even if they don’t use it or even if they hate it a lot of them still know it so support is a big plus PHP also gives you a ton of freedom and this is another example of something that’s both good and bad it’s not a typed language you don’t have to define your data types or anything like that there’s a million different ways to create the same functionality so integration is another good one you can use PHP with just about any database MySQL Postgres know what skew all databases like MongoDB there’s an adapter for pretty much excuse me any type of database or data store that you want to use there’s also a ton of frameworks available for PHP and this allows people that understand PHP but our masters create pretty significant applications frameworks do a lot of the hard stuff for us laravel is very popular they also have Symphony CodeIgniter there’s a huge list of frameworks for PHP you can also use multiple paradigms this ties into the freedom aspect you can use procedural or functional programming with PHP as well as hard core object-oriented code using classes most people start with procedural because it’s much easier and then you can gradually start to learn the object-oriented stuff alright and PHP can also be directly embedded into HTML and that’s also a huge plus and then it’s also pre-configured on most hosting environments especially shared hosting if you go to Hostgator or DreamHost or any of those companies they usually have pH pre-installed on their servers and there’s even one-click installation for things like wordpress and even ecommerce platforms like Magento and so on and there’s a lot of good free PHP scripts out there alright so those are the reasons why you should learn PHP now let’s take a look at some disadvantages so I said earlier that PHP was really easy to learn and it offers you a lot of freedom that can be a good advantage as far as you being able to learn a language but it can also be a huge disadvantage too much freedom can mean a poor language design PHP adapts its syntax from many different other languages Perl C C++ Java and so on so it could be extremely inconsistent and flaky it doesn’t really have in some sense it doesn’t really have its own identity okay so that leads us to the next one which is that it’s too easy to write bad code there’s a lot of bad scripts out there written in PHP like I said there’s a million ways to write the same functionality and this can make things very difficult and just annoying when you’re working with someone else’s code I’ve had times where I just can’t figure out what the hell they were thinking when they wrote it but PHP is so flexible that it still works you know if you visit the front-end of the website of the app it still works it’s just a very poor and difficult design and PHP is also weakly typed while that makes things easier this can also lead to bugs and issues okay so the next one is scalability PHP isn’t completely suitable for really big applications that use big data you can have problems with scaling it’s fine for small to medium sized applications and websites but when we start getting into apps with millions of users and thousands of pages it starts to get a little difficult to manage because it’s not highly modular I think a big part of that is to because it was designed to basically create dynamic websites not so much high tech applications if you’re building a really large application with big data you’re probably better off going with something like the mean stack all right now as far as security every language has its flaws PHP is completely open-source and it’s not compiled and this gives you gives it some vulnerabilities although a lot of the insecure PHP programs are due to bad code not really the language itself all right so these are pretty much the main disadvantages I think the biggest that the reason why is about some developers really hate PHP is its poor design and the code can really just be an ugly mess and it’s very inconsistent so I think that’s the main reason all right so the conclusion is up to you to decide again I’m not going to suggest PHP for your first language I’m not going to do that at all I will suggest PHP node or Python but I won’t go any further than that without knowing what works for you and how you code because everyone is different and it’s just stupid for me to say that this is the language you should learn because I don’t know you but the bottom line is all languages have good and bad qualities web link web technologies desktop programming languages anything has it has good and bad PHP is popular and widely used that’s a good enough reason for me to want to learn it or to have wanted to learn it but I would suggest that you learn other languages as well don’t don’t just stick with PHP for the rest of your career all right and then most of all most important to write good code or in good coding practices stay consistent make things very clean and PHP will work out just fine for you all right so hopefully you guys enjoyed this and learned a little bit something from it and hopefully I praised it enough for you guys that like PHP and I bashed it enough for you guys that hate it alright so thanks for watching