Question: Suppose I am reading a web page and the [URL](http://en.wikipedia.org/wiki/Uniform_Resource_Locator) is "<http://example.com/term/11,23>". How can I use [PHP](http://en.wikipedia.org/wiki/PHP) to get ONLY the integer in the URL?

Answer: 
I would advice against such design. This type of static variables no better than global variables. [This page](http://c2.com/cgi/wiki?GlobalVariablesAreBad) gives a few reasons why you should avoid them. Here are a few of them.

* Non-locality
* No Access Control or Constraint Checking
* Implicit coupling
* Concurrency issues
* Testing and Confinement

> 
> But the token for OAuth2 needs to be assigned on runtime. Is this a good way to go... ?
> 
> 
> 

Here it really seems to me like you would want to pass such token to the constructor of the Prefs object.
typically global configs are read from properties files at runtime. You can have varying config files for the development, QA, production environments.

The only thing you need to at least be aware of is that in a web application, if you set static variables from a web request, you could munge the data if you do not synchronize the setter. If you are only reading then you should be fine. 

An alternative to what you are doing is why not inject the OAuth key into a service that handles the authentication concerns of your system? You could do what you need to do with a static resource, but in this case, but you should be aware that you don't really need a static variable to hold the key.