array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'reflectionclass.iscloneable.php', 1 => 'ReflectionClass::isCloneable', ), 'up' => array ( 0 => 'class.reflectionclass.php', 1 => 'ReflectionClass', ), 'prev' => array ( 0 => 'reflectionclass.isanonymous.php', 1 => 'ReflectionClass::isAnonymous', ), 'next' => array ( 0 => 'reflectionclass.isenum.php', 1 => 'ReflectionClass::isEnum', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/reflection/reflectionclass/iscloneable.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
ReflectionClass::isCloneable — Returns whether this class is cloneable
This function has no parameters.
Example #1 Basic usage of ReflectionClass::isCloneable()
<?php
class NotCloneable {
public $var1;
private function __clone() {
}
}
class Cloneable {
public $var1;
}
$notCloneable = new ReflectionClass('NotCloneable');
$cloneable = new ReflectionClass('Cloneable');
var_dump($notCloneable->isCloneable());
var_dump($cloneable->isCloneable());
?>
The above example will output:
bool(false) bool(true)