note 9537 added to Chop
| From: | tracy at finifter dot com | Date: | Thu, 09 Nov 2000 22:12:53 +0000 |
| Subject: | note 9537 added to Chop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7552@lists.php.net to get a copy of this message | ||
To perform a perl-style chop function, do this:
function perl_chop ($string) {
$last_char = substr ($string, -1);
$chopped_string = ereg_replace ("$last_char$", "", $string);
return $chopped_string;
}
$string = perl_chop ($string);
http://www.php.net/manual/function.chop.php