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

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

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

PHP class implements example – PHP Interface

PHP class implements example What is an interface? An interface is a programming block which contains abstract methods, and used the same like abstract classes but with some differences. Interfaces can also be extended to the child classes but with “implements” keyword. Let’s see “PHP class implements” example for an Interface. Like an abstract class, … Read more

PHP abstract class and function – Abstraction in PHP

PHP abstract class and function – Abstraction in PHP PHP abstract class and function: In this chapter, we will see another object oriented programming feature that is an abstraction. The literal meaning of a word abstract is “existing in thought or as an idea but not having a physical or concrete existence”. It means abstraction is … Read more

PHP Class Constructor and Destructor

PHP Class Constructor and Destructor In the previous tutorial, we have seen the use of $this variable to point out the current calling object of a class. In this tutorial, you will see what are PHP Class Constructor and Destructor methods and their working in detail. There are many magic methods available in Object oriented PHP. … Read more