The following breaks my site quite badly:
define('FOO', get_foo());
However, the following works fine:
define('FOO', 'BAR');
Because define() expects a value for the constant and not the returned value of a function:
The value of the constant; only scalar and null values are allowed. Scalar values are integer, float, string or boolean values. It is possible to define resource constants, however it is not recommended and may cause unpredictable behavior.
You can't use function in define, this is not good. Define is used to make constants. Constants must not be changed, must have the same value during all the time. Functions, like get_foo(), can return different values. Php thinks that you want to put changable value to the constant. Try to put the result if this function to the variable:
$foo = get_foo();