PHP LTrim (), RTrim () and trim () Delete Word spaces instances, Ltrimrtrim
This example describes how to delete a word spaces in PHP ltrim (), RTrim (), and trim (). Share to everyone for your reference. The specific analysis is as follows:
The trim function in PHP does not have to be the same as in ASP, can automatically delete all spaces, PHP professional provides the RTrim () trim () function, interested in this friend can refer to.
The PHP instance code is as follows:
Copy the Code code as follows: <?php
$STR = "Remove space before and after";
echo "The original string in square brackets: [". $str. "]
";
echo "Raw string length:". strlen ($STR). "
";
$str 1=ltrim ($STR);
echo "Executes the length after LTrim ():". strlen ($str 1). "
";
$str 2=rtrim ($STR);
echo "Executes the length after RTrim ():". strlen ($str 2). "
";
$str 3=trim ($STR);
echo "The length after the trim () is performed:". strlen ($str 3). "
";
echo "Remove the string after the trailing space: [". $str 3. "]";
?>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/917039.html www.bkjia.com true http://www.bkjia.com/PHPjc/917039.html techarticle php LTrim (), RTrim () and trim () Delete Word spaces instances, Ltrimrtrim This example describes the LTrim (), RTrim () and trim () methods in PHP to delete the word spaces lattice. Share to everyone for your reference ...