File::stripTrailingSeparators()

File::stripTrailingSeparators() – strips trailing separators from a path

Synopsis

require_once 'File.php';

string File:stripTrailingSeparators ( string $path , string $separator = DIRECTORY_SEPARATOR )

Описание

This method removes the trailing directory separator (like "/" on *nix) from a path name.

Parameter

  • string $path - the path name where the trailing separator should be removed from.

  • string $separator - optional string that defines the separator. This parameter defaults to the value of the constant DIRECTORY_SEPARATOR that is pre-defined by PHP.

Return value

This methods returns the given path name without a trailing directory separator.

Замечание

This function can be called statically.

Пример

Using File:stripTrailingSeparators()

<?php
require_once "File.php";

echo 
File::stripTrailingSeparators("/home/foo/lala/");
?>

This example will print /home/foo/lala.

    Поддержать сайт на родительском проекте КГБ