This video is made to learn about static keyword and static function and static variable in PHP.
Static methods and properties in php is very useful feature. Static methods and properties in php can directly accessible without creating object of class. Your php class will be static class if your all methods and properties of the class is static. Static Methods and Properties in PHP will be treated as public if no visibility is defined.
Static Properties/Variables in PHP
Static properties of class is a property which is directly accessible from class with the help of ::(scope resolution operator). You can declare static property using static keyword. In other word you can make any property static by using static keyword.
Static Methods or functions
As in general class various process are same for methods and properties, same is with Static Methods and Properties in PHP. You can create your function or method static using static keyword. You can access all visible static methods for you using :: like in static variables.
Scope can be defined as the range of availability a variable has to the program in which it is declared. PHP variables can be one of four scope types −
Local variables
Function parameters
Global variables
Static variables.
Static Variables
The final type of variable scoping that I discuss is known as static. In contrast to the variables declared as function parameters, which are destroyed on the function's exit, a static variable will not lose its value when the function exits and will still hold that value should the function be called again.
You can declare a variable to be static simply by placing the keyword STATIC in front of the variable name.
In questa pagina del sito puoi guardare il video online Learn PHP Tutorial 27 static keyword and static function and static variable della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Champion Mahipal 27 novembre 2015, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 513 volte e gli è piaciuto 3 spettatori. Buona visione!