PHP | ReflectionClass isCloneable() Function
Last Updated :
04 Dec, 2019
The ReflectionClass::isCloneable() function is an inbuilt function in PHP which is used to check the specified class is cloneable or not.
Syntax:
bool ReflectionClass::isCloneable( void )
Parameters: This function does not accept any parameters.
Return Value: This function returns True if class is cloneable False otherwise.
Below programs illustrate the ReflectionClass::isCloneable() function in PHP:
Program 1:
<?php
class Company {
public function GeeksforGeeks() {}
public function GFG() {}
}
$B = new ReflectionClass( 'Company' );
$C = $B ->isCloneable();
var_dump( $C );
?>
|
Program 2:
<?php
class Alphabets {
public $A ;
private function __clone() {
}
}
$B = new ReflectionClass( 'Alphabets' );
$C = $B ->isCloneable();
var_dump( $C );
?>
|
Reference: https://www.php.net/manual/en/reflectionclass.iscloneable.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...