title: How to include/require external file in to the foreach loop and be able to read the loop's variable?
body: <p>I am trying to include an external file in the a foreach loop, and be able to read that variable of the foreach loop in that external php file. Please see the code below:</p>
  
  <pre><code>$ProductPDSLink = '';
  
  foreach($item-&gt;ProductRangeName as $rangeName){
  
      include($App_URL . '/Handler/_PDSSwitcherHandler.php');
  
  }
  </code></pre>
  
  <p>And in the included external php file the code below:</p>
  
  <pre><code>global $rangeName;
  global $ProductPDSLink;
  switch ($rangeName) {
      case 'Insurance':
          $ProductPDSLink .= "LInk";
          break;
      case 'Priority Protection':
          $ProductPDSLink .= "Link2";
          break;
      case 'Life Solutions':
          $ProductPDSLink .= "Link 3";
          break;
  }
  </code></pre>
  
  <p>Finally I try to echo it but nothing showing up.</p>
  
  <pre><code>echo $ProductPDSLink;
  </code></pre>
  
  <p>Thanks in Advance.</p>