Please don't use globals but instead pass variables in using a constructor - http://www.php.net/manual/en/language.oop5.decon.php

It makes life easier in the long run (class dependencies) and is considered better practice.