Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Author: Peter Dragicevic [peter-91@hotmail.de]
- * Authors-Website: http://petschko.org/
- * Licence: http://creativecommons.org/licenses/by-sa/4.0/
- * Date: 28.07.2015
- * Time: 10:34
- */
- if(!function_exists("mb_basename")) {
- /**
- * @param string $path - Path to convert
- * @param null $suffix - Remove this ending if exists
- * @return string - Filename without path (and may without suffix)
- */
- function mb_basename($path, $suffix = null) {
- if(mb_stripos($path, DIRECTORY_SEPARATOR) !== false)
- $basename = mb_substr($path, mb_strripos($path, DIRECTORY_SEPARATOR));
- else
- $basename = $path;
- if($suffix && mb_stripos($basename, $suffix)) {
- $suffix_pos = mb_strlen($suffix) * -1;
- $base_end = mb_substr($basename, $suffix_pos);
- if($base_end == $suffix)
- $basename = mb_substr($basename, 0, $suffix_pos);
- }
- return $basename;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement