Re: Property Accessors 1.2 for Final Review before Vote

From: Date: Sat, 05 Jan 2013 12:25:52 +0000
Subject: Re: Property Accessors 1.2 for Final Review before Vote
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-64547@lists.php.net to get a copy of this message
On 02.01.2013 12:36, Clint Priest wrote: > Here is the updated RFC incorporating the feedback from previous rounds > of discussion. > > https://wiki.php.net/rfc/propertygetsetsyntax-v1.2 One thing that I have not found in the RFC is how do you specify a default value AND accessors? Many examples show things like: protected $Seconds = 3600; public $Hours { get { return $this->Seconds / 3600; } set { $this->Seconds = $value * 3600; } } But what if I want to store something in a different internal representation for example with a default. Is this valid syntax? public $hexFoo = 10 { get { return dechex($this->foo); } set { $this->hexFoo = hexdec($value); } } Or is it this? public $hexFoo { get { return dechex($this->foo); } set { $this->hexFoo = hexdec($value); } } = 10; Is it possible at all? Cheers -- Jordi Boggiano @seldaek - http://nelm.io/jordi

« previous php.internals (#64547) next »