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 // Initializing a user-defined Class Departments class Departments { public function CSE() { } } // Using ReflectionClass() over the // user-defined class Departments $class = new ReflectionClass('Departments'); // Calling the isInstantiable() function $instance = $class->isInstantiable(); // Getting the value true or false var_dump($instance); ?> |
bool(true)
Program 2:
<?php // Initializing a interface named as TestFunction interface TestFunction { function F1(); function F2(); } // Using ReflectionClass() over the // specified interface $class = new ReflectionClass('TestFunction'); // Calling the isInstantiable() function and // getting the value true or false var_dump($class->isInstantiable()); ?> |
Output:
bool(false)
Reference: https://www.php.net/manual/en/reflectionclass.isinstantiable.php
Recommended Posts:
- PHP | ReflectionClass getDefaultProperties() Function
- PHP | ReflectionClass getReflectionConstants() Function
- PHP | ReflectionClass getInterfaceNames() Function
- PHP | ReflectionClass getMethods() Function
- PHP | ReflectionClass getConstant() Function
- PHP | ReflectionClass getExtensionName() Function
- PHP | ReflectionClass getExtension() Function
- PHP | ReflectionClass getStartLine() Function
- PHP | ReflectionClass getEndLine() Function
- PHP | ReflectionClass getDocComment() Function
- PHP | ReflectionClass getStaticPropertyValue() Function
- PHP | ReflectionClass getStaticProperties() Function
- PHP | ReflectionClass getProperty() Function
- PHP | ReflectionClass getProperties() Function
- PHP | ReflectionClass getFileName() Function
- PHP | ReflectionClass getConstructor() Function
- PHP | ReflectionClass getConstants() Function
- PHP | ReflectionClass getParentClass() Function
- PHP | ReflectionClass export() Function
- PHP | ReflectionClass getInterfaces() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

