Checks if class is readonly

# ReflectionClass::isReadOnly

(PHP 8 >= 8.2.0)

ReflectionClass::isReadOnly — Checks if class is readonly

### 说明

public function 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)

### 参见

- ReflectionClass::isAbstract() - 检查类是否是抽象类（abstract）
- Readonly classes

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open