note 14118 added to function.basename.php

From: Date: Wed, 18 Jul 2001 07:34:03 +0000
Subject: note 14118 added to function.basename.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-15525@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> http://www.php.net/manual/en/function.basename.php

« previous php.notes (#15525) next »