xref: /PHP-8.4/Zend/tests/property_hooks/get.phpt (revision 780a8280)
1--TEST--
2Basic get only property hook
3--FILE--
4<?php
5
6class Test {
7    public $prop {
8        get { return 42; }
9    }
10}
11
12$test = new Test;
13var_dump($test->prop);
14
15try {
16    $test->prop = 0;
17} catch (Error $e) {
18    echo $e->getMessage(), "\n";
19}
20
21?>
22--EXPECT--
23int(42)
24Property Test::$prop is read-only
25