Re: RFC: Anonymous Classes

From: Date: Mon, 23 Sep 2013 14:41:55 +0000
Subject: Re: RFC: Anonymous Classes
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-69273@lists.php.net to get a copy of this message
Hi, On Sep 23, 2013 at 3:05 PM, Joe Watkins <krakjoe@php.net> wrote: > On 09/23/2013 02:43 PM, Lars Strojny wrote: > >> Hi Joe, >> >> what about serialization for those classes? >> >> cu, >> Lars >> >> > Same as any other object; what you are creating is normal classes without > a (declared) name, nothing about the objects functionality has differs from > an object of a named class. > I think that the question was: How would you figure out method implementation for unserialized object of anonymous class? Consider this example... $o = new class() { private $a = 1; public function test() { echo $this->a; } }; $o->test(); $str = serialize($o); $o2 = unserialize($str); $o2->test(); How would this work? Jakub

« previous php.internals (#69273) next »