note 103623 deleted from reserved.variables.server by danbrown

From: Date: Sat, 23 Apr 2011 14:44:27 +0000
Subject: note 103623 deleted from reserved.variables.server by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179106@lists.php.net to get a copy of this message
Note Submitter: Darryl ---- A further refinement to the script below. <?php function GetBasePath() { return substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], "\\"))); } ?> If the var DIRECTORY_SEPARATOR is used instead of "\\", then it is usable in all OS's. For Example: return substr($_SERVER['SCRIPT_FILENAME'], 0, strlen($_SERVER['SCRIPT_FILENAME']) - strlen(strrchr($_SERVER['SCRIPT_FILENAME'], DIRECTORY_SEPARATOR)));

« previous php.notes (#179106) next »