You can make methods static which means you do not need to create an instance of the class in order to execute the method. For example:
The double colon is a scope resolution operator: PHP: Scope Resolution Operator (:
- Manual - it allows access to static and overridden class-level variables (properties) and methods (overriding in regards to the use of inheritance in object oriented programming) and class constants.
PHP Code:
<?php
class Output
{
public static function output_text($text)
{
echo $text;
}
}
// execute method
Output::output_text("<p>Really important text!</p>");
?>
