In this current PHP tutorial Section, we will study about late static binding in PHP, what is late static binding, how to use late static binding among classes, what are the uses of it in PHP etc.
In this current PHP tutorial Section, we will study about late static binding in PHP, what is late static binding, how to use late static binding among classes, what are the uses of it in PHP etc.PHP Late Static Binding:
A new feature called late static binding is introduced in PHP 5.3.0 which can be used to refer the called class.
The name late static binding is coined because of the static:: will no longer be resolved using the class where the method is defined.
Example:
<?php
class
One {}
}
}
class
Two extends One { public static function classIdentifier() {}
}
Two::classtest();
?>
Output:
One
Example:
<?php
class
One { public static function classIdentifier() {}
public static function classtest() {}
}
class
Two extends One { public static function classIdentifier() {}
}
Two::classtest();
?>
Output:
Two