class_exists
|
<?php class Person { private $name; private $age; private $id;
function setId( $id ) { $this->id = $id; } function getId(){ echo "get id method"; } function __clone() { $this->id = 0; } }
$classname = "Person"; if ( ! class_exists( $classname ) ) { throw new Exception( "No such class as $classname" ); }
$myObj = new $classname(); $myObj->getId(); ?>
|
|
|
|
|
HTML code for linking to this page:
Related in same category :
-
|