The example in this article describes how PHP uses the Trim function to remove the left and right spaces and special characters of a string. Share to everyone for your reference, specific as follows:
the trim () function in PHP is defined as follows :
Trim (string,charlist)
The parameter description is as follows:
String required. Specify the string to check.
Charlist
Optional. Specify which characters to remove from the string. If omitted, all of the following characters are removed:
"" "-NULL
"\ T"-tab
"\ n"-line Wrap
"\X0B"-Vertical tab
"\ r"-Carriage return
""-Space
The sample code is as follows:
<?php
$str = "\r\r (: @_@ Cloud Habitat community provides a large number of excellent scripts and materials to download @_@:) ";
echo Trim ($STR);
echo "<br/>";
Echo Trim ($str, "\r\r (::)");
>
The results of the operation are as follows:
(: @_@ cloud-dwelling community provides a wealth of excellent scripting and material downloads @_@:)
The @_@ cloud communities provide a wealth of excellent scripting and material downloads @_@
I hope this article will help you with the PHP program design.