ID:               33087
 Updated by:       [EMAIL PROTECTED]
 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

Reply via email to