Easy with such a powerful language as PHP !
Let's say we have a class like this :
class foo
{
var $name;
function foo($name)
{
$this->name=$name;
}
}
Then with the function :
function create_object($objectName, $className)
{
return new $className($objectName);
}
We can use it like this :
$o=create_object("myname","foo");