PHP character filter function to remove the last comma (RTrim) of a string _php tutorial

Source: Internet
Author: User
First of all, explain separately,

Trim filters both ends of the string,
RTrim filter String tail, =chop ()
LTrim filter string header.

Filter the key in the string can only use Str_replace.
Let me give you an example of how

PHP code
Copy the Code code as follows:
$str = ' 123,333,234, ';
Echo RTrim ($str, ', ');

RTrim Instance Code 2
Copy the Code code as follows:
$text = "\t\tthese is a few words:) ... ";
$trimmed = RTrim ($text);
$trimmed = "\t\tthese is a few words:) ..."
$trimmed = RTrim ($text, "\ T.");
$trimmed = "\t\tthese is a few words:)"
$clean = RTrim ($binary, "\x00". \x1f ");
Trim the ASCII control characters at the end of $binary
(from 0 to inclusive)
?>

http://www.bkjia.com/PHPjc/326706.html www.bkjia.com true http://www.bkjia.com/PHPjc/326706.html techarticle first, respectively, trim filter string ends, RTrim filter string tail, =chop () LTrim filter string header. The key in the filter string can only be used Str_replace . For example ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.