Re: Re: Variables in Variables?

From: Date: Sat, 19 Nov 2005 01:51:21 +0000
Subject: Re: Re: Variables in Variables?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-226095@lists.php.net to get a copy of this message
Ben wrote:
If I understand your question properly I'd explode $two_vars with whatever seperator you have between them and then you'll need to use eval to get your results. Maybe something like... $dbVars=explode(',',$two_vars); // Assuming comma seperator foreach($dbVars AS $key => $value) {
    $eval="\$temp=".$value.";";
    eval($eval);
    echo $temp;
}
WTF do you need eval() for?! $dbVars = explode( ',', $two_vars ); foreach( $dbVars as $value ) { echo $value; } ... does exactly the same thing.

« previous php.general (#226095) next »