tags:

views:

50

answers:

1

i am creating a simple authentication, acl script. i wonder if its ok to store a PDO database handle in a global variable?

whats the bad effects of using a global variable? anyone can edit from anywhere?

if i create a singleton like in zend framework Zend_Registry how will it make things any better?

A: 

It's fine. It will be destroyed when the request is over anyway so no other process will edit it or anything. Just make sure you use include_once so it doesn't connect every time.

Matt Williamson