Is the $this variable affectation authorized (clean enough)?

From: Date: Fri, 22 Mar 2002 10:47:53 +0000
Subject: Is the $this variable affectation authorized (clean enough)?
Groups: php.general 
Request: Send a blank email to php-general+get-89659@lists.php.net to get a copy of this message
Hi, is the $this variable affectation authorized (clean enough)? It's works in 4.1.x, but next php versions... class X { function polymorph($class){ // Backup vars here $this=new $class(); // Restore vars here } } What is the usage? - A (MySQL) table - A class to manage the table - A class by record type $x=new X(); $x->read_record(12); switch($x->type){// Got by read_record case 'X1': case 'X2': $x->polymorph($x->type); break; default: exit(1); } $x->specific_method();// From X1 or X2 class ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com

« previous php.general (#89659) next »