<?php
class Config {
//type constant
const maxConnections = 3;
//type fields
public static $host = "10.0.0.1";
public static $port = 0;
//type method
public static function getConnection() {
return self::$host . ":" . self::$port;
}
}
Config::$port = 52;
$connection = Config::getConnection();
//connection is "10.0.0.1:52"
echo $connection, "\n";
Config::$host = "10.0.0.3";
$connection = Config::getConnection();
//connection is "10.0.0.3:52"
echo $connection, "\n";