:::

28. static

The static keyword lets you use a class' property or method without having to create an instance of that class. It works like this:

class Person {
  public static $isAlive = "Yep!"
  public static function greet() {
    echo "Hello there!";
  }
}
echo Person::$isAlive;/
/ prints "Yep!"
Person::greet();
// prints "Hello there!"

:::

語系選擇