note 81549 added to function.getcwd
| From: | znupi69NOSPAMHERE at gmail dot com | Date: | Mon, 03 Mar 2008 18:39:09 +0000 |
| Subject: | note 81549 added to function.getcwd | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136704@lists.php.net to get a copy of this message | ||
In response to myself: that function will not work for cases like:
/usr/bin$: /home/johndoe/Work/script.php
So here's a better and simpler way (I think this one works for all cases)
<?php
function get_file_dir() {
global $argv;
return realpath($argv[0]);
}
?>
Knock yourself out :)
----
Server IP: 69.147.83.197
Probable Submitter: 77.81.204.37
----
Manual Page -- http://www.php.net/manual/en/function.getcwd.php
Edit -- https://master.php.net/note/edit/81549
Del: integrated -- https://master.php.net/note/delete/81549/integrated
Del: useless -- https://master.php.net/note/delete/81549/useless
Del: bad code -- https://master.php.net/note/delete/81549/bad+code
Del: spam -- https://master.php.net/note/delete/81549/spam
Del: non-english -- https://master.php.net/note/delete/81549/non-english
Del: in docs -- https://master.php.net/note/delete/81549/in+docs
Del: other reasons-- https://master.php.net/note/delete/81549
Reject -- https://master.php.net/note/reject/81549
Search -- https://master.php.net/manage/user-notes.php