I have known PHP basics, functional programming for a long time before. But this year, in my 2nd semester I have learned Object-Oriented Programming with Java. So I want to apply my knowledge of OOP to PHP. But I find it very difficult to think of any decent utilization. It's not like in Java everything is an object. I see it easier to connect to database an old way, to write some simple functions for logging or registration, etc.
All those examples http://php.net/manual/en/language.oop5.php just gives me knowledge about syntax, not methodology of using it.
So I began to think. Maybe it's because I wanted to apply OOP without any Framework, and it's no use without it? If so - any Framework recommendations that are easy to learn?
Most machine learning companies in Bangalore are continually upgrading the scripting language, its functionality, and performance, creating tools to support it, adding libraries, directories, and so on! So, unquestionably, PHP is still in the game in 2022, and probably there will be no such change in the coming years.
Originally Answered: Is it worth learning PHP in 2021? Yes 100% php is becoming popular day by day because of different CMS. Today if you want to learn web development then php is the best language to start with because of its easy to learn and easy to deploy quality. Hope its helps.
For beginner coders and those just diving into WordPress development, PHP is one of the best places you can start. It's a super simple and straightforward language, making it one of the best programming language to learn, so it's fairly easy to get into, and it makes up the backbone of online development.
OOP is a methodology used to organise your code into meaningful, reusable entities and it doesn't alone answer to the question of "how to best organize your code to create web applications".
Most of the web frameworks use Model-View-Controller architecture (MVC) along with OOP. In order to understand how web frameworks work, I suggest you to familiarize yourself with MVC as well (for a starting point, see "Coding Horror: Understanding Model-View-Controller")
Also, regardless of any frameworks, it is crucial to understand some basic concepts when creating web applications. At the minimum, familiarize yourself with how sessions work (http://www.php.net/manual/en/book.session.php), as well as how you can access databases (PDO for generic database connectivity, MySQL for MySQL-specific binding, etc.).
As for what web framework to choose, the options are plenty. Therefore consider the following pointers as informative:
Also note that unlike in Java, in PHP object-oriented features have been slowly added during its versions 4 and 5. Therefore, many web frameworks designed for earlier versions of PHP may not provide you as cleanly object-oriented design as you might want. Therefore when choosing a framework, consider whether you opt-in for backward-compatibility (PHP4 support) or are you seeking for a clean, object-oriented design in the framework (mostly PHP5 required).
OOP has its usage outside of a framework, you cannot compare apples with oranges.
The most respectable frameworks out there are written in OOP. So try to use one such framework in order to see use cases of OOP, then learn from that framework (step through with a debugger and learn how the framework works from the inside).
I would recommend you two things, if you really want to become a pro:
Regarding the databases: modern PHP code should use PDO.
The framework will only show you usages of design patterns and how to organize your code, so you'll develop a "common sense" for it.
After you've passed that point, you will be able to invent your own OOP-world, without a framework (if this really needs be, although a framework gives you the time to actually be innovative).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With