useing __FILE__ and locating root folder in php ? how do i do this?
<p>lets say we have a directory.</p>

<p>project/index.php</p>

<p>in index.php</p>

<pre><code>&lt;?php
require 'config/config.php';
echo ROOTPATH;
?&gt;
</code></pre>

<p>project/config/config.php</p>

<pre><code>&lt;?php
define('ROOTPATH', rtrim(dirname(__FILE__), '\\/'));
?&gt;
</code></pre>

<p>it will return like
D:\Project Storage\Web Projects\www\project\config.</p>

<p>question:</p>

<ol>
<li><p>is there an easy way to get the rootpath without puting it on the project folder ? ( i know this is supid but i cant stand to ask )</p></li>
<li><p>is there a way to get the \project\ ( root folder ) ? even if we change the folder location ?</p></li>
</ol>

<p>Thanks</p>

<p>Adam Ramadhan</p>

<p>ps*
please leave a comment if you dont understand what i mean.</p>
