PHP 8.4.1 Released!

ReflectionClass::isReadOnly

(PHP 8 >= 8.2.0)

ReflectionClass::isReadOnlyChecks if class is readonly

说明

public ReflectionClass::isReadOnly(): bool

Checks if a class is readonly.

参数

此函数没有参数。

返回值

true if a class is readonly, false otherwise.

示例

示例 #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)

参见

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top