RE: [PHP] value contained within a variable contained within another variable

From: Date: Wed, 17 Sep 2003 18:59:01 +0000
Subject: RE: [PHP] value contained within a variable contained within another variable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162909@lists.php.net to get a copy of this message
You should be able to do something like this: $kk1_current = "something"; $data = array ("kk1_current","kk2_current","mk_current"); $data_post = $$data[0]; . "\n"; // I want, $data_post = whatever is inside $kk1_current in this example -- strval obviously doesn't work in the case echo $data_post; -----Original Message----- From: DougD [mailto:info@bigfresh.com] Sent: Wednesday, September 17, 2003 7:18 PM To: php-general@lists.php.net Subject: [PHP] value contained within a variable contained within another variable I may be way off track with what I am trying to do, but here is my scenario and I sure appreciate any insights. There is a string stored in $kk1_current and I want to pull from the array the variable name, add the "$" and then retreive the string with the varialbe $kk1_current. This will allow to echo the contents of each varialbe contained with the array. Make sense? $kk1_current = "something"; $data = array ("kk1_current","kk2_current","mk_current"); $temp = "$" . $data[0]; $data_post = strval($temp) . "\n"; // I want, $data_post = whatever is inside $kk1_current in this example -- strval obviously doesn't work in the case echo $data_post; THANKS! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#162909) next »