WordPress at a glance

untrailingslashit() WP 1.0

Removes trailing forward slashes and backslashes if they exist.

The primary use of this is for paths and thus should be used for paths. It is not restricted to paths and offers no specific path support.

✈ 1 time = 0.000011s = very fast | 50000 times = 0.01s = speed of light PHP 7.0.5, WP 4.5

No Hooks.

Return

String. String without the trailing slashes.

Usage

untrailingslashit( $string );
$string(string) (required)
What to remove the trailing slashes from.

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

<?php
function untrailingslashit( $string ) {
	return rtrim( $string, '/\\' );
}

Related Functions

From category: Formatting

No comments
    Hello, !     Log In . Register