Re: Are variable object vars possible?

From: Date: Thu, 02 Oct 2003 18:39:47 +0000
Subject: Re: Are variable object vars possible?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-164805@lists.php.net to get a copy of this message
Jason Godesky wrote:
I've been playing with variable variables and variable functions lately, and I was wondering if there was anyway to use that with object variables? I'm trying to make classes that can store instances in a database, and I'd like to have an abstract parent class with a load() method ... but since each of its children have different variables, I need to do a SELECT * from the database, and for each field/row pair, do something like $this-
{$field} = $row[$field] If anyone knows how to do this, I'd appreciate
your help Try:
$this->$field = $row[$field]; -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

« previous php.general (#164805) next »