title: Variable in php require_once file path
body: <p>How do you take the following and substitue part of the file path as a variable?</p>
  
  <pre><code>require_once $_SERVER['DOCUMENT_ROOT'] . '/directory1/directory2/directory3/file.php';
  </code></pre>
  
  <p>I want to substiture directory2 with a variable $dir2. Simply inserting the variable as follows does not work?</p>
  
  <pre><code>require_once $_SERVER['DOCUMENT_ROOT'] . '/directory1/$dir2/directory3/file.php';
  </code></pre>
  
  <p>Thanks.</p>