note 111508 deleted from function.rtrim by danbrown
| From: | danbrown@php.net | Date: | Mon, 04 Mar 2013 17:48:43 +0000 |
| Subject: | note 111508 deleted from function.rtrim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193825@lists.php.net to get a copy of this message | ||
Note Submitter: discern
----
<?php
function strrtrim($string, $strip) {
return substr($string, -strlen($strip)) === $strip ? substr($string, 0,
strlen($string)-strlen($strip)) : $string;
}
$strip = ' and ';
$string = 'This food is bland and ';
echo rtrim($string, $strip);
// This food is bl
echo strrtrim($string, $strip);
// This food is bland
?>