note 45433 deleted from function.substr by nlopess
| From: | nlopess@php.net | Date: | Tue, 07 Sep 2004 09:18:23 +0000 |
| Subject: | note 45433 deleted from function.substr by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76139@lists.php.net to get a copy of this message | ||
Note Submitter: speedor at gmx dot de
----
This tiny function deletes all chars specified in $chars
//Löscht alle Zeichen in $chars:array aus $string:string
function del_chars($string, $chars)
{
for($i=0; $i < strlen($string); $i++)
{
if(!in_array($string{$i}, $chars))
{
$string2.=$string{$i};
}
}
return $string2;
}
e.g.
echo del_chars('delete this .', array('.'));
will return:
'delete this '