Home  >  Article  >  Backend Development  >  How to remove the last character in php

How to remove the last character in php

藏色散人
藏色散人Original
2021-04-02 09:32:081705browse

In PHP, you can use the rtrim function to remove the last character. The syntax for using this function is "rtrim(string,charlist)". The function of this function is to remove the blank characters or other characters on the right side of the string. Predefined characters.

How to remove the last character in php

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

rtrim() function removes strings Whitespace characters or other predefined characters on the right.

Related functions:

ltrim() - Removes whitespace characters or other predefined characters on the left side of the string

trim() - Removes both sides of the string Blank characters or other predefined characters

Syntax

rtrim(string,charlist)

How to remove the last character in php

[Recommended learning: PHP video tutorial]

The above is the detailed content of How to remove the last character in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn