I need to serialize a proxy class. The class uses __set and __get to store values โโin an array. I want serialization to look like it's just a flat object. In other words, my class looks like this:
class Proxy { public $data = array(); public function __get($name) { return $data[$name] } }
and I want the foreach loop to return all keys and values โโin $ data when I say:
foreach($myProxy as $key)
Is it possible?
source share