How to refer to a local path in an OS-friendly way?
<p>In PHP how do you refer to files in an OS friendly manner? I'm looking at some code like</p>

<pre><code>&lt;?php
require_once(dirname(dirname(__FILE__)).'/common/config.inc.php');

...
</code></pre>

<p>that I have to run on a Windows machine, but it doesn't parse the path right:</p>

<pre><code>PHP Warning:  require_once(C:\workspace/common/config.inc.php): failed to open stream: No such file or directory in C:\workspace\somescript.php on line 2
PHP Fatal error:  require_once(): Failed opening required 'C:\workspace/common/config.inc.php' (include_path='.;C:\php5\pear') in C:\workspace\somescript.php on line 2
</code></pre>

<p>It looks like it's trying to open with the forward-slashes which windows doesn't like. The file C:\workspace\commonconfig.inc.php exists. The script is just not finding it because it has the forward-slashes right?</p>

<p>In the require_once statement, shouldn't I be expressing the last part of the path in some os-friendly way? How do you do that? </p>

<p>In PHP, is there something similar to Python's   <a href="http://docs.python.org/library/os.path.html#os.path.normpath" rel="nofollow">os.path.normpath(path)</a> ? ..which takes a path-like string and returns the path appropriate to the running OS...</p>
