I need to make a new copy of some of my classes. I want to pass the name of the class through a variable. Like this
<?php
class class1{
..........
..........
}
class class2 extends class1{
..........
..........
}
$array(
1=>'class1',
2=>'class2'
)
$new_class=new $array[1];
?>
This is NOT works. it prints
Fatal error: Cannot instantiate non-existent class
Is there any way to escape this problem?