Is it fine to assign $this to another object loaded from memcache in the constructor?
I am mainly worried about performance and memory.
I was thinking something like this:
function __construct($userid){
global $memcachedvar;
if($userobject = $memcachedvar->get($userid){
$this = $userobject;
}
}
Is this a bad design pattern?
No, it’s not OK. It is, in fact, invalid.
$thisis magical and may not be re-assigned.