Multiple Variable Variables in PHP
<p>I am fairly new to PHP and programming in general...  I am attempting to use a foreach loop to set some options on a page I have created.  It all works except for the last section, where I am attempting to assign variables dynamically, so I can use them outside the loop.</p>

<pre><code>&lt;?PHP

$array=array(foo, bar, baz);

foreach ($array as $option) {

  // I have if statements to determine what $option_req 
  // and $option_status end up being, they work correctly.

  $option_req="Hello";
  $option_status="World";

  $rh='Req_';
  $sh='Status_';

  $$rh.$$option=$option_req;
  $$sh.$$option=$option_status;

  }

echo "&lt;br&gt;R_Foo: ".$Req_foo;
echo "&lt;br&gt;S_Foo: ".$Status_foo;
echo "&lt;br&gt;R_Bar: ".$Req_bar;
echo "&lt;br&gt;S_Bar: ".$Status_bar;
echo "&lt;br&gt;R_Baz: ".$Req_baz;
echo "&lt;br&gt;S_Baz: ".$Status_baz;

?&gt;
</code></pre>

<p>When the loop is finished, should this now give me six variables?  </p>

<pre><code>$Req_foo
$Status_foo

$Req_bar
$Status_bar

$Req_baz
$Status_baz
</code></pre>

<p>I have played with this a bit, searches on Google seem fruitless today.</p>
