Re: dynamic variabels (fwd)

From: Date: Thu, 02 Nov 2000 13:51:35 +0000
Subject: Re: dynamic variabels (fwd)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-23391@lists.php.net to get a copy of this message
maybe : function test($varname) { $the_var = "this->" . $varname; $selectedarray =$this->layer->getTrefwoordenArray($$the_var); } (not tested) <hennink@patrijs.max.nl> a écrit dans le message news: Pine.LNX.4.21.0011021416430.1092-100000@patrijs.dhs.org... > 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. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#23391) next »