I've been beating my head on the wall for two days on this one... and could reall use some clarification and hopefully justification on Classes used in modules.
PHP allows you to define a class like
class myCustomClass{
var foo = 'bar';
var pea = 'nut';
function coolClassFunc(){
//do some cool stuff
}
}
however, while drupal doesn't stop you from making a new instance of myCustomClass it does seem to block the instance from being in the global scope.
so if I had:
$objA = new myCustomClass();
$objB = new stdClass();
function someIncludedFunc(){
global $objA, $objB;
echo "objA is ".gettype($objA);
echo "objB is ".gettype($objB);
}
this would spit out:
"objA is NULL"
"objB is Object"
if you ran this code independant of a drupal install both objects would be seen as objects by the included function... but when executed as a module inside a drupal enviroment, only the stdClass carries through to the global as shown in the example.
can anyone confirm this?
can anyone tell me why?
thanks all very much for the repsonses.