Properties In Interfaces

<?php

interface i {
    public $p { get;}
}

class x implements i {
    public $p = 1 { get => $this->p;}
}

echo (new x)->p;

Since PHP 8.4, it is possible to have properties in an interface.

In fact, one must add a property to a property. Since this is an interface, that hook cannot have a body.

Hence, the hook has to be defined in every implementing class.

See Also

PHP Features

Last updated: 14 July 2026