I'm trying to figure a way to do create a class with only the class's name in PHP.
E.g.:
$class = "MyClass";
if(class_exists($class))
$unit = new $class($param1, $param2);
else
$unit = new Unit($param1, $param2);
Is there a way to do this in PHP? If possible, I'd also like to know if this is possible in Java.
Cheers! thanks in advance.