RE: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP

From: Date: Mon, 29 Nov 2010 14:23:14 +0000
Subject: RE: [PHP-DEV] RFC: C-sharp style property get/set syntax for PHP
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-50690@lists.php.net to get a copy of this message
On Sun Nov 28 06:18 PM, president@basnetworks.net wrote: > > Link to the RFC: > http://wiki.php.net/rfc/propertygetsetsyntax > Nice RFC, just an idea for an alternative syntax (added to the RFC as #2): property Hours { get { return $this->seconds / 3600; } set { $this->seconds = $value * 3600; } // The variable $value holds the incoming value to be "set" } class TimePeriod { private $seconds; public [Hours] $hours1; public {use Hours;} $hours2; } Would favor re-use similar to traits by injecting the set/get code around the property.

« previous php.internals (#50690) next »