(PHP 4, PHP 5, PHP 7, PHP 8) Show chop — Alias of rtrim() DescriptionThis function is an alias of: rtrim(). Notes
Kubo2 ¶ 7 years ago
JumpIfBelow ¶ 7 years ago
krkbpk at gmail dot com RamaKrishna Kothamasu ¶ 9 years ago
rahuls8730 at gmail dot com ¶ 13 years ago
anon at mailinator dot com ¶ 15 years ago
func_get_args() as $b) {push($ar,$b[strlen($b)-1]); View Discussion Improve Article Save Article View Discussion Improve Article Save Article The chop() in PHP is used to remove white spaces or any other specified characters from the end of a string. Syntax: string chop($string, $character) Parameters: This function accepts two parameters as shown in the above syntax and are described below:
Return Value: The return type of the chop() function is string. It returns the string after removing the specified characters from the end. Program 1: In the below program a string is initialized as hello geeks!, by using chop() function the characters – ‘s’ and ‘!’ are removed from the end of the string.
Output: Hello Geeks! Hello Geek Program 2: In the below program, since no character parameter is mentioned. Then automatically the newlines will be removed from the given string.
Output: Hello Geeks! best wishes Hello Geeks! best wishesHello Geeks! best wishes Reference: What is the use of chop?An abbreviation for a chemotherapy combination that is used to treat non-Hodgkin lymphoma and is being studied in the treatment of other types of cancer. It includes the drugs cyclophosphamide, doxorubicin hydrochloride (hydroxydaunorubicin), vincristine sulfate (Oncovin), and prednisone. Also called CHOP.
How do I delete a word in PHP?PHP str_replace() Function. Replace the characters "world" in the string "Hello world!" with "Peter": ... . Using str_replace() with an array and a count variable: $arr = array("blue","red","green","yellow"); ... . Using str_replace() with fewer elements in replace than find: $find = array("Hello","world");. Which of the following is an alias for the chop () PHP function?The chop() function is used to remove the whitespaces and other predefined characters from the right side of a string. This function is an alias of rtrim() function.
What is PHP Ltrim?The ltrim() function removes whitespace or other predefined characters from the left side of a string. Related functions: rtrim() - Removes whitespace or other predefined characters from the right side of a string. trim() - Removes whitespace or other predefined characters from both sides of a string.
|