This doesn't force you to use $unique_var as a variable name(I know it can be worked around). One of the biggest problem with globals is that they can crash and burn if someone else's code purges it by accident.
Also my pattern allows 'load on demand', I can incorporate it in if I'd want to, your does not.
Re:Signs of Crappy PHP Software
by lox on Monday July 05, 2010 @07:35AM
(#1487974)
Might I suggest something like Config::get('look_ahead') rather than GlobalSingleton? The design pattern used to implement something is generally far less useful than the purpose of the thing in terms of a name.
GlobslSingleton::set('Something Meaningful',$unique_var);
and
GlobslSingleton::get('Something Meaningful');
I don't think this is complex at all.
This doesn't force you to use $unique_var as a variable name(I know it can be worked around). One of the biggest problem with globals is that they can crash and burn if someone else's code purges it by accident.
Also my pattern allows 'load on demand', I can incorporate it in if I'd want to, your does not.