Page 1 of 1

dynamically creating variables

Posted: Thu Jun 24, 2004 11:34 am
by dsdsdsdsd
hello;

I have:

Code: Select all

$array = ("aaa","bbb","ccc");
I want to create variables:

Code: Select all

$aaa_string = "";
$bbb_string = "";
$ccc_string = "";
this loop will not do it though:

Code: Select all

for ($i=0 ; $i<count($array) ; $i++)
  &#123; $array&#1111;$i] . "_string" = "";
  &#125;
any thoughts?

thanks
Shannon Burnett
Asheville NC USa

Posted: Thu Jun 24, 2004 11:58 am
by hawleyjr
try something like:

Code: Select all

$&#123;$array&#1111;0].'_string'&#125; = '';

Posted: Thu Jun 24, 2004 12:56 pm
by dsdsdsdsd
thanks hawleyjr