note 78480 added to reserved.variables
| From: | doheth dot co dot uk at osu1 dot php dot net | Date: | Sat, 13 Oct 2007 23:15:29 +0000 |
| Subject: | note 78480 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131376@lists.php.net to get a copy of this message | ||
slight improvement to the example by 'andres at andresj dot ath dot cx' for determining
the path to the currently script.
Previous version:
<?php
// If your script is included from another script:
$included_directory = substr(__FILE__, 0, strrpos(__FILE__, '/'));
?>
Windows uses back-slash to indicate folders, so this didn't work on localhost for me. All you
need to do is convert any back-slashes to forward-slashes. This should work on all systems:
<?php
// If your script is included from another script:
$included_file = str_replace('\\', '/', __FILE__);
$included_directory = substr($included_file, 0, strrpos($included_file, '/'));
?>
----
Server IP: 194.145.210.4
Probable Submitter: 87.113.29.239
----
Manual Page -- http://www.php.net/manual/en/reserved.variables.php
Edit -- https://master.php.net/note/edit/78480
Del: integrated -- https://master.php.net/note/delete/78480/integrated
Del: useless -- https://master.php.net/note/delete/78480/useless
Del: bad code -- https://master.php.net/note/delete/78480/bad+code
Del: spam -- https://master.php.net/note/delete/78480/spam
Del: non-english -- https://master.php.net/note/delete/78480/non-english
Del: in docs -- https://master.php.net/note/delete/78480/in+docs
Del: other reasons-- https://master.php.net/note/delete/78480
Reject -- https://master.php.net/note/reject/78480
Search -- https://master.php.net/manage/user-notes.php