NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP on Win.: Get Drive Letter for Current Script

Jayesh Sheth jayeshsh at ceruleansky.com
Sun Mar 13 17:24:05 EST 2005


Hi Dan,

Looking at my test script again, there is an important difference between
getcwd() and __FILE__ that may be of interest of to others.

The sample script is:
<?php
echo getcwd();
echo "\n";
echo __FILE__;
?>

I invoked it with:
cd c:\php4cli
php-cli.exe c:\devel\php\getcwd.php

And it outputted:
C:\PHP4CLI
c:\devel\php\getcwd.php

So, perhaps getcwd() outputs where you currently are at the command line,
but __FILE__ outputs the full path (including drive letter) to the
currently running script.

Best regards,

- Jay



More information about the talk mailing list