note 76919 deleted from reserved.variables by cmb

From: Date: Tue, 05 Nov 2019 11:34:40 +0000
Subject: note 76919 deleted from reserved.variables by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212915@lists.php.net to get a copy of this message
Note Submitter: andres at andresj dot ath dot cx ---- To get the directory of the current script: (I think this is a little more resource-friendly, but then again with all the fast computers available, it does not matter so much...) <? // For the script that is running: $script_directory = substr($_SERVER['SCRIPT_FILENAME'], 0, strrpos($_SERVER['SCRIPT_FILENAME'], '/')); // If your script is included from another script: $included_directory = substr(__FILE__, 0, strrpos(__FILE__, '/')); echo $script_directory . '<br />'; echo $included_directory . '<br />'; ?> If you have a script that only includes the script written above in a directory called 'includer', and I access it from a web browser, this will be what I see: /path/to/includer/ /path/to/included/

« previous php.notes (#212915) next »