static.php
class Formatter {
const FORMAT = "Name: %s, %s";
public static $static_const = "public static $static_const = Statische Eigenschaft";
public static function namensFormatierung($vorname, $nachname) {
return sprintf(self::FORMAT, $vorname, $nachname);
}
}
/*
$className = "Formatter";
echo $className::namensFormatierung("Jens", "Haake");
*/
echo Formatter::$static_const . "<br>";
echo Formatter::namensFormatierung("Jens", "Haake") . "<br>";
echo Formatter::namensFormatierung("Albert", "Einstein") . "<br>";