Well, I have dealed with global and const values. Figure out something like this:
<?
global $foo;
class MyClass{
const BAR = $foo;
...
Looks like this is not allowed, so I just want to know if is it valid code or is just a mistake in some assignation.
PS: I know that there are many ways to do what I am expecting, just want to discart this.
const
expects a constant. $foo
is a variable, not a constant.
It is clearly explained in the PHP Class Constant Documentation:
The value must be a constant expression, not (for example) a variable, a property, a result of a mathematical operation, or a function call.
Use define function.
Globals are bad practice