#33087 [Opn->Bgs]: properties

From: Date: Mon, 03 Apr 2006 11:42:39 +0000
Subject: #33087 [Opn->Bgs]: properties
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-95270@lists.php.net to get a copy of this message
ID: 33087 Updated by: tony2001@php.net Reported By: glashtin at sbcglobal dot net -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: n/a PHP Version: 5CVS-2005-05-20 (dev) New Comment: Use __get()/__set(). Previous Comments: ------------------------------------------------------------------------ [2005-05-20 18:36:10] glashtin at sbcglobal dot net Description: ------------ I would like to see properties added to php like most other OOP languages have. The way I see it being used is class MyClass { private $FMyVar1 private $FMyVar2; property $MyVar1 read=$FMyVar1 write=$FMyVar1; property $MyVar2 read=$this->MyFunction(); write=$FMyVar2; private function MyFunction() { if ( $something ) $this->FMyVar2 = 'This'; else $this->FMyVar2 = 'That'; return $this->FMyVar2; } } Or something like that. I know there are work arounds but I would still like to see properties add so that I can clean up my code. In my opinion it looks better to use echo $MyClass->MyVar2; than echo $MyClass->MyFunction(); just a suggestion. Thanks ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33087&edit=1

« previous php.bugs (#95270) next »