Is it possible to use a namespace in PHP from a variable. I want to load classes dynamically based on a configuration array; something like that:
foreach ($content_types as $key => $content_type) {
$namespace = $content_type['entity'];
use $namespace;
}
Instead doing this:
use Bundle\Entity\User;
use Bundle\Entity\Project;
Note: I am using Symfony, the error message returned when I do that is:
Parse Error: syntax error, unexpected 'use' (T_USE)