WordPress at a glance

wp_basename() WP 1.0

i18n friendly version of basename()

✈ 1 time = 0.000025s = very fast | 50000 times = 0.30s = very fast PHP 7.0.8, WP 4.6

No Hooks.

Return

String.

Usage

wp_basename( $path, $suffix );
$path(string) (required)
A path.
$suffix(string)
If the filename ends in suffix this will also be cut off.
Default: ''

Code of wp_basename: wp-includes/formatting.php VER 4.9.8

<?php
function wp_basename( $path, $suffix = '' ) {
	return urldecode( basename( str_replace( array( '%2F', '%5C' ), '/', urlencode( $path ) ), $suffix ) );
}

Related Functions

From tag: PHP analogues (PHP functions replacement)

More from tag: path (directory folder)

More from category: Helper Functions

No comments
    Hello, !     Log In . Register