Blog

python tutorials and learn python

Created with Sketch.

PHP __callStatic

PHP __callStatic Summary: in this tutorial, you’ll learn about the PHP __callStatic() magic method and how to use it to make your code more flexible. Introduction to the PHP __callStatic() magic method PHP invokes the __callStatic() method when you invoke an inaccessible static method of a class. The following shows the syntax of the __callStatic()…
Read more

PHP __call

PHP __call Summary: in this tutorial, you will learn about the PHP __call() magic method and how to use it to wrap existing functions. Introduction to the PHP __call magic method The __call() method is invoked automatically when a non-existing method or inaccessible method is called. The following shows the syntax of the __call() method:…
Read more

PHP __toString

PHP __toString Summary: in this tutorial, you will learn how to use the PHP __toString() method to return the string representation of an object. Introduction to the PHP __toString() method The __toString() is one of a magic method in PHP. The following shows the syntax of the __toString() method: public function __toString ( ) :…
Read more

PHP Magic Methods

PHP Magic Methods Summary: in this tutorial, you will learn about PHP magic methods that override the default actions when the object performs the actions. Introduction to PHP magic methods PHP magic methods are special methods in a class. The magic methods override the default actions when the object performs the actions. By convention, the…
Read more

PHP Late Static Binding

PHP Late Static Binding Summary: in this tutorial, you will learn about the PHP late static binding, which is an interesting feature that has been added to the PHP 5.3 Introduction to late static binding in PHP Let’s start with a simple example. <?php class Model { protected static $tableName = ‘Model’; public static function…
Read more

PHP Class Constants

PHP Class Constants Summary: in this tutorial, you will learn about PHP class constants and how to use them effectively. Introduction to the PHP class constants Sometimes, you need to define a constant that is specific to a class. In this case, you can use the PHP class constants. To define a constant of a…
Read more

PHP Static Methods and Properties

PHP Static Methods and Properties   Summary: in this tutorial, you will learn about PHP static methods and static properties and understand the differences between the  $this and self. Introduction to PHP static methods and properties So far, you have learned how to define a class that consists of methods and properties. To use the methods…
Read more

PHP Traits

PHP Traits Summary: in this tutorial, you will learn how to use PHP traits to share functionality across independent classes, which are not in the same inheritance hierarchy. Introduction to PHP traits Code reuse is one of the most important aspects of object-oriented programming. In PHP, you use inheritance to enable code reuse in different…
Read more

PHP Polymorphism

PHP Polymorphism Summary: in this tutorial, you will learn about the polymorphism concept in object-oriented programming. And you’ll also learn how to implement polymorphism in PHP using abstract classes or interfaces. What is polymorphism? Polymorphism is a Greek word that literally means many forms. In object-oriented programming, polymorphism is closely related to inheritance. Polymorphism allows…
Read more

PHP Interface

PHP Interface   Summary: in this tutorial, you will learn about the PHP interface and how to use an interface to define a contract between classes. Introduction to the PHP interface An interface allows you to specify a contract that a class must implement. To define an interface, you use the interface keyword as follows:…
Read more