note 37276 added to function.basename

From: Date: Sat, 08 Nov 2003 12:52:58 +0000
Subject: note 37276 added to function.basename
Groups: php.notes 
Request: Send a blank email to php-notes+get-60138@lists.php.net to get a copy of this message
No comments here seems to take care about UNIX system files, which typically start with a dot, but they are not "extensions-only". The following function should work with every file path. If not, please let me know at my email address. <?php function remove_ext($str) { $noext = preg_replace('/(.+)\..*$/', '$1', $str); print "input: $str\n"; print "output: $noext\n\n"; } remove_ext("/home/joh.nny/test.php"); remove_ext("home/johnny/test.php"); remove_ext("weirdfile."); remove_ext(".hiddenfile"); remove_ext("../johnny.conf"); ---- Manual Page -- http://www.php.net/manual/en/function.basename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+37276 Delete -- http://master.php.net/manage/user-notes.php?action=delete+37276&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+37276&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#60138) next »