When returning reference to the object member which is instantiated inside the function, the object is destructed upon returning (which is a problem). It's easier to see the code:<?phpclass MemcacheArray { public $data; ... function &getData($file, $expire = 3600) { $o = new MemcacheArray($file, $expire); return $o->data; }?>Here, destructor is called upon return() and the reference becomes a normal variable.My solution is to store objects in a pool until the final exit(), but I don't like it. Any other ideas?<?php protected static $instances = array(); function &getData($file, $expire = 3600) { $o = new MemcacheArray($file, $expire); self::$instances[$file] = $o; return $o->data; }?>