I have a class in which I want to define some constants used by other classes. The const keyword isn't enough for me because I want for example to use a mathematical expression like 2.0 * pi() as a constant. How is done?
I understand you want to assign a mathematical expression to a constant.
Like:
const FOO = 2.0*pi();
PHP constants can only contain scalar values. If you want other classes to use shared information, you will have to use static functions/methods for this.
Example:
static public function foo()
{
return 2.0*pi();
}