Possible Duplicate:
PHP namespace with Dynamic class name
How to declare class from string?
code
$name = 'the_class';
require_once $name.'.php';
$class = new \resource\$name();
error
Parse error: syntax error, unexpected '$name' (T_VARIABLE), expecting identifier (T_STRING)
You will need to dynamically construct the namespace path:
Note: I like to be explicit with literal backslashes.