when should i use my own defined webroot and server root
<pre><code>$thisFile = str_replace('\\', '/', __FILE__);
$docRoot = $_SERVER['DOCUMENT_ROOT'];

$webRoot  = str_replace(array($docRoot, 'library/config.php'), '', $thisFile);
$srvRoot  = str_replace('library/config.php', '', $thisFile);
</code></pre>

<p>This is how I get the web root and the server root</p>

<p><em>web root</em> is the folder name where my files belongs, <em>server root</em> is the <code>C:/xampp/htdocs/folder_name</code></p>

<p>I just want to ask when should I use webroot and server root.</p>

<p>I just notice that if you are referencing a file ex: href or img src, then only web root works but not server root</p>

<p>But, if you require a file, ex. <code>require_once 'file.php';</code> only server root works not webroot</p>
