函数原型
before_last_bar( string $string ): string
函数描述
Removes last item on a pipe-delimited string.
是否弃用
未弃用
函数参数
-
$string
string
Required - A pipe-delimited string.
函数返回值
string Either $string or everything before the last pipe.
函数位置
File: wp-includes/l10n.php.
函数源码
function before_last_bar( $string ) {
$last_bar = strrpos( $string, '|' );
if ( false === $last_bar ) {
return $string;
} else {
return substr( $string, 0, $last_bar );
}
}
源码链接
变更日志
| Version | Description |
|---|---|
| 2.8.0 | Introduced. |

