English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

PHP Basic Tutorial

PHP Advanced Tutorial

PHP & MySQL

PHP Reference Manual

PHP chop() Function Usage and Example

PHP String Character String Functions Manual

The chop() function is an alias of the rtrim() function

Syntax

chop(string,charlist)

Definition and Usage

It is used to remove spaces

Return Value

It returns the modified string

Parameter

Serial NumberParameters and Description
1

str

This string needs to be escaped

2

charlist

Used to specify the characters to be deleted

Online Example

Try the following example

<?php
   $str = "oldtoolbag.com!";
   
   echo $str . "\n";
   echo chop($str,"com!");
?>
Test and see‹/›

Output Result

oldtoolbag.com!
w3codebox

PHP String Character String Functions Manual