PHP Anonymous functions with examples in detail

PHP Anonymous functions

PHP Anonymous functions In this chapter, you will learn another useful feature of PHP which is PHP Anonymous functions. An anonymous function is simply a PHP function but as its name suggests, it’s anonymous, which means it’s not having any name. Then how can we use it? But first, let’s see how it looks. A normal … Read more

Magic constants in PHP – Learn in details with the examples

What are Magic constants in PHP? The Magic constants in PHP are predefined constants that start and end with double underscores (__), with capital letters, and whose values change as per their use in a program. These constants are called magic constants as their value changes where they will be used. There are nine Magic … Read more

PHP Magic methods – Magic methods in PHP – Detailed tutorial

PHP Magic methods

What are magic methods in PHP? PHP Magic methods are a special kind of method defined in OOP PHP,  which gets called automatically when a certain event occurs on an object of a class. PHP Magic methods names start with double underscores ( __ ). We have already seen such two methods __construct() and __destruct() … Read more

PHP Type Hinting with interface and abstract class

PHP Type Hinting with interface and abstract class

PHP Type Hinting In the last chapter, we have seen the PHP type hinting for arrays and objects. In this chapter, we will see how in some situations object type hinting would not work, and then, in that case, we can use abstract class or interface type hinting. The PHP Type hinting for the interface … Read more

Type hinting in PHP with example in detail

Type hinting in PHP

What is type hinting in PHP? As the name suggests, Type hinting in PHP is a hint about the data type of an argument in the function definition. Type hinting provides better data handling used in a program, as type hinting will strictly check the data send to the functions in a program. Currently, we are … Read more

Traits in PHP with examples in detail

Traits in PHP In previous chapters of inheritance, abstract class, an inheritance we have seen the importance and benefits of code reusability. In this tutorial you will what are Traits in PHP in detail. Using inheritance you can achieve a parent-child relationship where you can keep the reusable code in the parent class and then inherit … Read more

PHP Late static binding in detail with examples

PHP Late static binding PHP Late static binding is a very useful and important feature of object oriented PHP which is introduced in PHP version 5.3. As the name suggests Late static binding is a binding related to static but it is Late 🙂 Confused? Let’s break down the Late Static Binding. What is Binding? In … Read more

PHP static variable and static function

PHP static variable and static function What is Static? PHP static variable and static function: Static meaning is which doesn’t change or remains the same. In object oriented PHP sometimes its better to use variables and function of a class without declaring an object of that class. Using static functionality you can achieve this type of access … Read more

Polymorphism in PHP with example in OOP

Polymorphism in PHP with example What is Polymorphism in Object oriented PHP? Polymorphism in PHP is one of the most important concepts in application development. Let’s see Polymorphism in PHP with example. The word Polymorphism means many forms or many types. In object oriented PHP’s Polymorphism principle, different classes can have the same method names which … Read more

PHP Dependency Injection in detail

PHP Dependency Injection What is Dependency Injection in PHP? Before looking into what is PHP Dependency Injection lets see what is a dependency. In previous chapters inheritance, abstract classes and interface we have seen the concept of code reusability. We can use code from one class into another through inheritance. Similarly, you can reuse code of, let’s say … Read more