I need to change the type of object from stdClass to "myClass", so 开发者_运维问答like does PDO::fetch_object("myClass");
$inc = new stdClass;
$inc = funct_for_set_type_of_object("myClass"); // here the function to do
// namespace conversion
echo get_class($inc);
Expected result:myClass
I need function like above: "get_class", but with behaviour like "set_class".
I need function like above: "get_class", but with behaviour like "set_class".
I short: There is no class cast in PHP, but I don't know, if this is really your problem
$x = $pdo->fetchObject($classname);
As far as I can see there is no need for a class cast anymore, if you provide the right class name.
PDOStatement::fetchObject()
精彩评论