← All built-ins / rtrim()

rtrim()

rtrim(...$args): string

Parameters

NameTypeDescription
$sstringinput string

Return value

The string without trailing whitespace.

Example

echo "[" . rtrim("   hello  ") . "]";
[   hello]

See also

trim()ltrim()chop()