PHP | ReflectionClass isInstantiable() Function
Last Updated :
17 Dec, 2019
The ReflectionClass::isInstantiable() function is an inbuilt function in PHP which is used to check the specified class is instantiable or not.
Syntax:
bool ReflectionClass::isInstantiable( void )
Parameters: This function does not accept any parameters.
Return Value: This function returns TRUE if the specified class is instantiable, otherwise return FALSE.
Below programs illustrate the ReflectionClass::isInstantiable() function in PHP:
Program 1:
<?php
class Departments {
public function CSE() { }
}
$class = new ReflectionClass( 'Departments' );
$instance = $class ->isInstantiable();
var_dump( $instance );
?>
|
Program 2:
<?php
interface TestFunction {
function F1();
function F2();
}
$class = new ReflectionClass( 'TestFunction' );
var_dump( $class ->isInstantiable());
?>
|
Reference: https://www.php.net/manual/en/reflectionclass.isinstantiable.php
Share your thoughts in the comments
Please Login to comment...