-- Greg Donald <[EMAIL PROTECTED]> wrote
(on Wednesday, 23 April 2008, 04:04 PM -0500):
> What is gained by using Zend_Registry? Seems to me I could more
> easily use the existing PHP $GLOBALS or even $GLOBALS['registry'] if I
> wanted/needed a namespace.
>
>
> Zend_Registry::set('index', $value);
>
> versus
>
> $GLOBALS['index'] = $value;
Globals are a really bad idea in almost every case, and they lead to
some really hairy problems with scoping, determining how and when a
variable is set, and much more. Do some googling for 'php globals
problems', and you'll start to get the idea. Try wrapping existing code
that relies on globals in an MVC framework some time, and you'll start
to see the issues quickly and noisily.
A Registry is a design pattern that is used to solve the problems of
globals in a more maintainable and predictable way.
That said, you're free to use $GLOBALS instead of Zend_Registry if you
still fail to see the point or simply prefer $GLOBALS.
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/