August 2016
Intermediate to advanced
610 pages
11h 55m
English
PHP lets you access properties or methods without having to create an instance of the class. The keyword used for this purpose is static.
static keyword after stating the visibility level when declaring an ordinary property or method. Use the self keyword to reference the property internally:class Test
{
public static $test = 'TEST';
public static function getTest()
{
return self::$test;
}
}self keyword will bind early, which will cause problems when accessing static information in child classes. If you absolutely need to access information from the child class, use the static keyword in place of self. This process is referred to as Late Static Binding.Read now
Unlock full access