PHP chop()

PHPz
Release: 2024-08-29 12:52:50
Original
413 people have browsed it

If there are any whitespaces or any other characters that are predefined in a string, a function called chop() function can be used to remove them from the right side of the string which is also an alias for a function called rtrim() function in PHP. This function is supported in the fourth version and the above versions after fourth version of PHP and the return value of this function in PHP is string but is a changed string when compared to the input string passed to the function.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax

The syntax to declare chop() function in PHP is as follows:

chop(string_name, char_list)
Copy after login

where,

  • string_name: Is the name of the string that requires trimming, that is the chop() function must be applied on. This is the essential parameter of the syntax and is mandatory. The data type of this parameter is string data type.
  • char_list: It specifies the list of characters to be removed from the string that is passed as a parameter. If the char_list parameter is not specified in the chop() function that is being called, the chop() function will be applied on the following list of characters like an ordinary space,

The above is the detailed content of PHP chop(). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!