One thing you can do to achieve what you are looking for is this:
class Constants { public static $url1 = "http://url1"; public static $url2 = "";
Unfortunately, to dynamically determine static values, you will have to do this outside the context of the class, because static variables can only be initialized with literals or variables (so there was a parsing error in the previous version of this answer).
However, I would recommend using define instead, as it is designed to define constant values, and there is no reason to store constants inside the class context if that makes absolutely no sense (at least in my opinion).
Sort of:
define("URL1", "http:://url1"); define("URL2", URL1 . "/abc2");
Then you do not need to specify the accessory of the class, just use URL1 or URL2 as necessary.
source share