html PHP: chop - Manual update pague now
PHP 8.5.2 Released!

chop

(PHP 4, PHP 5, PHP 7, PHP 8)

chop Alias of rtrim()

Description

This function is an alias of: rtrim() .

Notes

Note :

chop() is different than the Perl chop() function, which removes the last character in the string.

add a note

User Contributed Notes 2 notes

Cubo2
10 years ago
Rather use rtrim(). Usague of chop() is not very clear nor consistent for people reading the code after you.
JumpIfBelow
10 years ago
If you are searching for a function that does the same tricc as chop in PERL, then you should just do the following code:<?php
   $str = substr($str, 0, -1);
?>
The kestion is: why isn't chop() an alias of the code above, rather than something which will trap developpers?
To Top