title: PHP undefined variable variable in strict environment
body: <p>My Magento environment is set to <code>error_reporting(E_ALL);</code> and I'm debugging a bunch of warnings.</p>
  
  <p>I have a loop and markup that looks like this:</p>
  
  <pre><code>foreach ( $vars as $key =&gt; $value) {
      $value  = is_array($value) ? $value: trim($value);
      ${$key} = ( !empty($value) ? $value: '' );
  };
  // echo $type; die(); &lt;----- die() shows value correctly
  echo $type; // &lt;----- get notices
  
  $fieldType = ( $type == 'money' ? 'number' : 'text' );
  echo "&lt;div class=\"input-box {$fieldType}\"&gt;";
  ... rest of code here
  </code></pre>
  
  <p>My end goal is to create a string and throw variables into it; so the checking should be done prior to that.</p>
  
  <p>I am getting this error notice <code>Undefined variable: type</code> when trying to use the dynamically created variable. If I <code>echo $type; die();</code> than I get a value just fine. If I check <code>get_defined_vars()</code> I see my <code>$type</code> variable in the array so I know it's there. I just can't get the variable to be pre-set inside of the initial loop.</p>
  
  <p>I've tried something like <code>${$key} = ( !empty($value) ? $value: 'something' );</code> to no avail as well.</p>
  
  <p>This is my var_dump</p>
  
  <pre><code>array(11) {
    ["title"] =&gt; string(23) "Name:"
    ["instructions"] =&gt; string(0) ""
    ["isrequired"] =&gt; string(1) "1"
    ["classnames"] =&gt; string(0) ""
    ["defaultval"] =&gt; string(0) ""
    ["page"] =&gt; string(1) "1"
    ["type"] =&gt; string(4) "text"
    ["id"] =&gt; string(6) "Field1"
    ["requiredstar"] =&gt; string(0) ""
   }
  </code></pre>