PHP rtrim() Function
Complete PHP String Reference
Definition and Usage
The rtrim() function will remove whitespaces or other predefined character
from the right side of a string.
Syntax
Parameter |
Description |
string |
Required. Specifies the string to check |
charlist |
Optional. Specifies which characters to remove from the
string. If omitted, all of the following characters are removed:
- "\0" - NULL
- "\t" - tab
- "\n" - new line
- "\x0B" - vertical tab
- "\r" - carriage return
- " " - ordinary white space
|
Example 1
<html>
<body>
<?php
$str = "Hello World! ";
echo "Without rtrim: " . $str;
echo "<br />";
echo "With rtrim: " . rtrim($str);
?>
<body>
<html>
|
The browser output of the code above will be:
Without rtrim: Hello World!
With rtrim: Hello World!
|
If you select "View source" in the browser window, you will see the following
HTML:
<html>
<body>
Without rtrim: Hello World! <br />With rtrim: Hello World!
</body>
</html>
|
Example 2
<?php
$str = "Hello World!\r\n";
echo "Without rtrim: " . $str;
echo "<br />";
echo "With rtrim: " . rtrim($str);
?>
|
The browser output of the code above will be:
Without rtrim: Hello World!
With rtrim: Hello World!
|
If you select "View source" in the browser window, you will see the following
HTML:
<html>
<body>
Without rtrim: Hello World!
<br />With rtrim: Hello World!
</body>
</html>
|
Complete PHP String Reference
Learn how your website performs under various load conditions
|
|
WAPT
is a load, stress and performance testing tool for websites and web-based applications.
In contrast to "800-pound gorilla" load testing tools, it is designed to minimize the learning
curve and give you an ability to create a heavy load from a regular workstation.
WAPT is able to generate up to 3000 simultaneously acting virtual users using standard hardware configuration.
Virtual users in each profile are fully customizable. Basic and NTLM authentication methods are supported.
Graphs and reports are shown in real-time at different levels of detail, thus helping to manage the testing process.
Download the free 30-day trial!
|
|