Getting main folder
<p>To this day i'm using that piece of code to locate public_html to count the folders to go back in order to import files:</p>

<pre><code>$config_path = array_reverse(explode( DIRECTORY_SEPARATOR , getcwd()));
$co = 0;
foreach($config_path as $val){
    if($val == "public_html")
        break;
    $co += 1;
}
$config_path = '';

if($co != 0){
    for($i = 0 ; $i &lt; $co ; $i++){
        $config_path .= '../';
    }
}
</code></pre>

<p>and then i'm using it like that:</p>

<pre><code>require_once ($config_path.'core/db-class.php');
</code></pre>

<p>That piece of code serve me pretty good , though I feel like its limiting me because when I use WAMP I need to have public_html folder and such</p>

<p>I'm looking for a php function something like - <code>getMainRoot()</code></p>

<p>So I can do something like</p>

<pre><code>require_once (getMainRoot().'core/db-class.php');
</code></pre>
