note 30556 deleted from reserved.variables by sniper

From: Date: Tue, 21 Oct 2003 19:43:44 +0000
Subject: note 30556 deleted from reserved.variables by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59071@lists.php.net to get a copy of this message
Note Submitter: vlad.neosurge.net ---- If you're having problems getting PHP to just output the filename and not the whole path, this function might work for you: function filename() { $host = $_SERVER['PHP_SELF']; $i = strlen ($host); while (($stop!=1) and ($i>=0)) { if ($host[$i] != "/") { $new = $host[$i] . $new; $i--; } else $stop=1; } $new = explode ('.', $new); return $new[0]; } It returns just the filename, without the path or any slashes or the extension. I used it to automatically output the page name as a header on the page in a template.

« previous php.notes (#59071) next »