|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-22 03:52 UTC] johannes@php.net
-Status: Open
+Status: Bogus
-Package: Feature/Change Request
+Package: *General Issues
[2010-12-22 03:52 UTC] johannes@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 02:00:01 2025 UTC |
Description: ------------ I think that it would be nice to have real properties present in PHP. I mean properties like those in C# but a little more flexible by allowing getter and setter to have different visibility. See sample code below: Reproduce code: --------------- class person { public $firstName, $lastName; public getter fullName { // may also have () return "{$this->firstName} {$this->lastName}"; } public setter fullName ($value) { // may also not have ($value) but a special var. list ($this->firstName, $this->lastName) = explode (' ', $value, 2); } } $p = new person; $p->fullName = "Foo bar"; echo $p->firstName . "\n"; echo $p->lastName . "\n"; echo $p->fullName . "\n"; Expected result: ---------------- Foo bar Foo bar Actual result: -------------- n/a