note 45433 added to function.substr
| From: | speedor at gmx dot de | Date: | Tue, 07 Sep 2004 08:38:03 +0000 |
| Subject: | note 45433 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-76131@lists.php.net to get a copy of this message | ||
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 '
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45433
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45433&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45433&report=yes
Search -- http://master.php.net/manage/user-notes.php