On Thu, 2010-05-13 at 20:27 +0100, Jared Williams wrote:
> Hi,
> Keep thinking with what is in php.next that interfaces seem
> overkill?
>
> Doesn't
>
> trait JSON
> {
> function toJSONString()
> {
> return json_encode(get_object_vars($this));
> }
> }
> class A
> {
> use JSON;
>
> public $a = 1;
> protected $b = 2;
> private $c = 3;
> }
No. The goal is to allow json_encode($foo); to do what makes sense in
the case. You might re-use the implementation by implementing it using
traits, but tha's a different problem than what this interface solves.
johannes
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php