Using namespaces with classes created from a variable
问题 So I created these two classes //Quarter.php namespace Resources; class Quarter { ... } //Epoch.php namespace Resources; class Epoch { public static function initFromType($value, $type) { $class = "Quarter"; return new $class($value, $type); } } Now this is a a very simplified version of both, but is enough to illustrate my question. The classes as they are shown here will not work as it will not find the Quarter class. To make it work I could change the $class variable to $class = "