note 98582 deleted from function.basename by danbrown

From: Date: Fri, 25 Jun 2010 13:35:00 +0000
Subject: note 98582 deleted from function.basename by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-170417@lists.php.net to get a copy of this message
Note Submitter: Daniel Bttner ---- To get the current filename without an extension you may use the following. <?php function getfilename(){ $info = pathinfo($_SERVER["SCRIPT_NAME"]); $fn = basename($_SERVER["SCRIPT_NAME"],'.'.$info['extension']); return $fn; } echo getfilename(); // output example "index" // assuming that the file calling the function is "index.php" ?>

« previous php.notes (#170417) next »