note 95705 deleted from function.chdir by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 Jan 2010 04:01:57 +0000 |
| Subject: | note 95705 deleted from function.chdir by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165044@lists.php.net to get a copy of this message | ||
Note Submitter: Csongor Halmai
----
Sorry but the previous note from php dot duke at qik dot nl is a bit confusing and not exact enough
I think so I redefine the symptom.
Take a look at the following code:
<?php
var_dump( getcwd() );
chdir( "./" ); // this eliminates the anomaly
var_dump( getcwd() );
?>
Under windows XP if I open a command prompt by Start -> Run -> cmd.exe and launch the script
by the following command:
php "c:\my_code.php"
then the output will be the following:
string(40) "C:\Documents and Settings\<username>"
string(40) "C:\Documents and Settings\<username>"
There is no surprise.
But if I open a command prompt from Total Commander by Command => DOS command menu when I stand
in the C:\ directory and after this I issue the eariler command:
php "c:\my_code.php"
then I get the following result:
string(3) "c:\"
string(3) "C:\"
Shortly: Total commander launches my php script with small drive letter while cmd.exe does with
capital drive letter. This ambiguity can be eliminated by a chdir( "./" ) function call.