#34194 [NEW]: Real properties in PHP classes

From: Date: Fri, 19 Aug 2005 14:41:22 +0000
Subject: #34194 [NEW]: Real properties in PHP classes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-83818@lists.php.net to get a copy of this message
From: stochnagara at hotmail dot com Operating system: PHP version: 5CVS-2005-08-19 (CVS) PHP Bug Type: Feature/Change Request Bug description: Real properties in PHP classes 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 -- Edit bug report at http://bugs.php.net/?id=34194&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34194&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34194&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34194&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=34194&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=34194&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=34194&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=34194&r=needscript Try newer version: http://bugs.php.net/fix.php?id=34194&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=34194&r=support Expected behavior: http://bugs.php.net/fix.php?id=34194&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=34194&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=34194&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=34194&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34194&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=34194&r=dst IIS Stability: http://bugs.php.net/fix.php?id=34194&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=34194&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=34194&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=34194&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=34194&r=mysqlcfg

« previous php.bugs (#83818) next »