note 14118 deleted from function.basename by jimw

From: Date: Sat, 15 Dec 2001 22:16:28 +0000
Subject: note 14118 deleted from function.basename by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-22856@lists.php.net to get a copy of this message
<p> The wbasename() function above to extract the basename of a DOS filename doesn't work if there's no backslash in the input. The following function improves this case. </p> <p> function wbasename($input) { for($i=0; $i < strlen($input); $i++ ) { $pos = strpos($input, '\\', $i); if ($pos != false) $lastpos = $pos; } if ($lastpos) { return substr($input, $lastpos + 1, strlen($input)); } else { return $input; } } </p>

« previous php.notes (#22856) next »