dynamic variabels (fwd)
| From: | hennink at patrijs dot max dot nl | Date: | Thu, 02 Nov 2000 13:17:40 +0000 |
| Subject: | dynamic variabels (fwd) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23386@lists.php.net to get a copy of this message | ||
Hi,
Doen anybody know how to solve the following problem.
I'm trying to prevent to use a large switch statement but unfortunately
this code doesn't work yet.
function test($varname) {
$var = "\$this->" . $varname;
$selectedarray =$this->layer->getTrefwoordenArray($var);
}
The normal approach would be
switch($var) {
case 1:
$selectedarray=$this->layer->getTrefwoordenArray($this->1);
break;
case 2:
$selectedarray=$this->layer->getTrefwoordenArray($this->2);
break;
// and so on for about 20 variabeles.
}
please help me!
with regards,
--
Tijmen Hennink
Max.nl
tijmen@max.nl
tel : 055-5270270
fax : 055-5270279
------------------------------------------------------------------------------
Customer: I'm running Windows '98
Tech: Yes.
Customer: My computer isn't working now.
Tech: Yes, you said that.