Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3518 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79702 invoked by uid 1007); 20 Jul 2003 17:14:48 -0000 Message-ID: <20030720171448.79700.qmail@pb1.pair.com> To: internals@lists.php.net References: <20030720155214.18238.qmail@pb1.pair.com> <20030720163649.50501.qmail@pb1.pair.com> Date: Sun, 20 Jul 2003 21:44:44 +0430 Lines: 50 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Posted-By: 217.219.1.254 Subject: Re: Property setter and getter in PHP5 From: masoud@iranphp.net ("Masoud") Hi John I knew __get and __set available, but i want to told C# like syntax is a nice and clear syntax if available in php5 , so we dont need to check property name and then set value . "John Lim" wrote in message news:20030720163649.50501.qmail@pb1.pair.com... > Hi Masoud, > > It's already available. See > > http://www.phppatterns.com/index.php/article/articleview/28/1/2/ > > "Masoud" wrote in message > news:20030720155214.18238.qmail@pb1.pair.com... > > It's just a suggestion to have a syntax like this in PHP5! > > > > A property is similar to a field (a member variable), with the exception > > that there is a getter and a setter > > method, as follows : > > > > public class Car > > { > > private string make; > > public string Make > > { > > get { return make; } > > set { make = value; } > > } > > } > > > > Car c = new Car( ); > > c.Make = "Acura"; // use setter > > String s = c.Make; // use getter > > > > above example is a simple C# example in NET Framework Essentials. > > > > > > Masoud > > > > > >