Dependency injection in PHP is a handy technique to keep the code maintainable and re-usable. While coding our PHP classes, we often come to a situation where one class depends on data from another class or a class is dependent on data which is supposed to vary from object to object. Let’s explore a very simple example of How dependency…
Category: PHP
Inheritance in PHP
Inheritance in PHP is useful when we need to create classes with some common, while few contrasting behaviors. In such case, we create a parent class for shared characteristics and child classes for distinct ones. We discussed inheritance in our “Learn OOP in PHP” post, we should extend our code from example given there. Setting Up Classes For better understanding…
Learn OOP in PHP
If you want to learn OOP in PHP then it is a good step towards making yourself an expert PHP developer. In this post, I will be focusing on basic concepts of OOP in PHP with a little bit of code. What is OOP ? Object oriented programming is a useful programming technique. In object oriented programming, the code is…
PHP mysqli class to connect with MySQL database
PHP mysqli class is one of the multiple ways to connect with MySQL database using PHP. In this post we will learn about PHP mysqli class, it’s useful methods and properties. Following logical steps will show you how to use mysqli class to access MySQL database in PHP: Connecting with MySQL database using PHP Creating a Table in MySQL Database…
Important string functions in PHP
Some functions are very common and we use them frequently in our projects. No matter which CMS or Framework we are using but as long as they are based on PHP we can utilize these PHP functions to perform some basic tasks. implode() in PHP The implode() function converts an array into an string and separate each element with the…