note 130660 added to language.oop5.property-hooks
| From: | vchlight@gmail.com | Date: | Tue, 17 Feb 2026 17:50:18 +0000 |
| Subject: | note 130660 added to language.oop5.property-hooks | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222552@lists.php.net to get a copy of this message | ||
Examle #11 - access to parent hook
<?php
class Strings
{
public string $val = 'parent val' {
get => $this->val . ' parent hook';
}
}
class CaseFoldingStrings extends Strings
{
public bool $uppercase = true;
public string $val = 'child val' {
get => $this->uppercase
? strtoupper(parent::$val::get())
: strtolower(parent::$val::get())
;
}
}
$case = new CaseFoldingStrings;
var_dump($case->val); // CHILD VAL PARENT HOOK
----
Server IP: 206.189.2.9
Probable Submitter: 89.150.59.34
----
Manual Page -- https://php.net/manual/en/language.oop5.property-hooks.php
Edit -- https://main.php.net/note/edit/130660
Del: integrated -- https://main.php.net/note/delete/130660/integrated
Del: useless -- https://main.php.net/note/delete/130660/useless
Del: bad code -- https://main.php.net/note/delete/130660/bad+code
Del: spam -- https://main.php.net/note/delete/130660/spam
Del: non-english -- https://main.php.net/note/delete/130660/non-english
Del: in docs -- https://main.php.net/note/delete/130660/in+docs
Del: other reasons-- https://main.php.net/note/delete/130660
Reject -- https://main.php.net/note/reject/130660
Search -- https://main.php.net/manage/user-notes.php