Namespaces and dynamic initialization of class problem

Hello everybody,

I know I can do

class myClass{


}

$class = ‘myClass’;

$instance = new $class;

… and everything works fine. But
when i use namespaces and I try to do the same dynamic call I get errors
ie

use \path\ o\example as example

$class = ‘example\myClass’;

$instance = new $class;

Is not working.

I must also say that the following works

$instance = new example\myClass ;

Is there something wrong with what I am trying to do ?

Thank you in advance!

Yes, that was the problem. Thank you very much logic_earth, you answer saved me a lot of time.
P.S :
The correct use is
path\ o\example\myClass and not \path\ o\example\myClass as i wrote in my previews post.

You need to use the full namespace, you cannot use the alias.
This is because the string is used at runtime, but the alias-uses are converted at compile time.