Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73203 invoked by uid 1010); 25 Aug 2005 10:29:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 73188 invoked from network); 25 Aug 2005 10:29:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Aug 2005 10:29:23 -0000 X-Host-Fingerprint: 64.233.184.193 wproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.184.193:14646] helo=wproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A7/65-28235-38D9D034 for ; Thu, 25 Aug 2005 06:29:23 -0400 Received: by wproxy.gmail.com with SMTP id i24so97016wra for ; Thu, 25 Aug 2005 03:29:20 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=E4eQWKvCWSY/pj9g8uuEawJdk/3nZ/MBjU93Pqb7esLIDhmSeZAa6Do0N4LC284Ke126uzNp3ROuWdytVM4Oavg0WChPVay13pRpmW0h16RekwEjxJSgPWZHvn0X+O3Due43YuJ4OjpjIcsU/doAWb0RNkFDFUZOSQ09U2taFHI= Received: by 10.54.100.1 with SMTP id x1mr1746119wrb; Thu, 25 Aug 2005 03:29:20 -0700 (PDT) Received: by 10.54.7.6 with HTTP; Thu, 25 Aug 2005 03:29:20 -0700 (PDT) Message-ID: Date: Thu, 25 Aug 2005 13:29:20 +0300 To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Real properties in PHP From: manchokapitancho@gmail.com (Marian Kostadinov) I wrote about real properies a few days ago but no one seems to be interested in it. 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: Sample 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) =3D explode (' ', $value, 2); } } $p =3D new person; $p->fullName =3D "Foo bar"; echo $p->firstName . "\n"; echo $p->lastName . "\n"; echo $p->fullName . "\n"; Sample result: ---------------- Foo bar Foo bar