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.
Basis of: user_trailingslashit(), trailingslashit()
1 time = 0.000001s = speed of light | 50000 times = 0.01s = speed of light | PHP 7.3.12, WP 5.4
No Hooks.
Return
String. String without the trailing slashes.
Usage
untrailingslashit( $string );
- $string(string) (required)
- What to remove the trailing slashes from.
Changelog
Since 2.2.0 | Introduced. |
Code of untrailingslashit() untrailingslashit WP 5.6
function untrailingslashit( $string ) {
return rtrim( $string, '/\\' );
}Related Functions
From category: Formatting
- absint()
- add_magic_quotes()
- antispambot()
- backslashit()
- balanceTags()
- capital_P_dangit()
- convert_smilies()
- ent2ncr()
- force_balance_tags()