note 74585 deleted from function.trim by bjori
| From: | bjori@php.net | Date: | Fri, 20 Apr 2007 09:09:30 +0000 |
| Subject: | note 74585 deleted from function.trim by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125584@lists.php.net to get a copy of this message | ||
Note Submitter: mark at crashandburn dot co dot uk
Reason: useless
----
I needed a simple function to do what trim does, but with the second parameter acting as ADDITIONAL
characters to trim, not the ONLY characters.
nice and simple:
<?php
function mytrim($string, $params = null)
{
if ($params)
{
// double trim - one for $params, and then a regular trim
$string = trim(trim($string, $params));
}
else
{
$string = trim($string);
}
return $string;
}
?>
which can be further simplified, but helped me when i needed to remove trailing slashes from a path
as well as other bits.