(PHP 8 >= 8.2.0)
ReflectionClass::isReadOnly — Checks if class is readonly
此函数没有参数。
示例 #1 ReflectionClass::isReadOnly() example
<?php
class TestClass { }
readonly class TestReadOnlyClass { }
$normalClass = new ReflectionClass('TestClass');
$readonlyClass = new ReflectionClass('TestReadOnlyClass');
var_dump($normalClass->isReadOnly());
var_dump($readonlyClass->isReadOnly());
?>
以上示例会输出:
bool(false) bool(true)