note 49582 deleted from function.basename by nlopess

From: Date: Thu, 03 Feb 2005 10:07:31 +0000
Subject: note 49582 deleted from function.basename by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-84417@lists.php.net to get a copy of this message
Note Submitter: spartacus at openphp dot nl Reason: useless ---- I created a simple function to get the name of the file without extension. Here it is: <?php //© 2005 SpArTaCuS function getbasename($url) { $url = basename($url, ".gif"); $url2 = explode(".", $url); if (count($url2) > 2) { $c = count($url2); $c--; foreach ($url2 as $n => $v) { if ($n != $c) { $url3 .= $v; } } return $url3; } else { return $url2[0]; } } ?> I hope you like it ;) Greetz, Spartacus

« previous php.notes (#84417) next »