Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3520 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98804 invoked by uid 1007); 20 Jul 2003 17:37:45 -0000 Message-ID: <20030720173745.98797.qmail@pb1.pair.com> To: internals@lists.php.net References: <20030720155214.18238.qmail@pb1.pair.com> <20030720163649.50501.qmail@pb1.pair.com> <20030720171448.79700.qmail@pb1.pair.com> Date: Sun, 20 Jul 2003 22:07:39 +0430 Lines: 82 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: [PHP-DEV] Re: Property setter and getter in PHP5 From: masoud@iranphp.net ("Masoud") Hi Derick which syntax is clear ? current syntax ? //--------------------------------------------------- class testClass { function __set($name,&$value) { switch ($name) { case 'propertyOne': { //do something $value='anything'; return true; break; } case 'propertyTwo': { //do something break; } } } } or c# like syntax ? //--------------------------------------------------------------- class testClass { var $propertyOne { get { //do something return $value; } set { //do something $propertyOne=$value; } } } It was just a suggestion to better (clear and bugfree) coding . Masoud "Derick Rethans" wrote in message news:Pine.LNX.4.53.0307201918460.6493@jdi.jdimedia.nl... > Hi, > > On Sun, 20 Jul 2003, Masoud wrote: > > > 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 . > > You can use C# for that ;) No really, I think the PHP 5 syntax is okay > here, PHP is just not C#. > > regards, > Derick > > -- > "Interpreting what the GPL actually means is a job best left to those > that read the future by examining animal entrails." > ------------------------------------------------------------------------- > Derick Rethans http://derickrethans.nl/ > International PHP Magazine http://php-mag.net/ > ------------------------------------------------------------------------- >