Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3515 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18240 invoked by uid 1007); 20 Jul 2003 15:52:14 -0000 Message-ID: <20030720155214.18238.qmail@pb1.pair.com> To: internals@lists.php.net Date: Sun, 20 Jul 2003 20:22:12 +0430 Lines: 26 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: Property setter and getter in PHP5 From: masoud@iranphp.net ("Masoud") 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