note 45140 added to function.str-replace

From: Date: Fri, 27 Aug 2004 09:41:03 +0000
Subject: note 45140 added to function.str-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-75411@lists.php.net to get a copy of this message
I find it a filtering and removing from strings a tedious task, so I created the function str_remove() to help me. It follows this sytax: mixed str_remove ( mixed search, mixed subject ) <?php function str_remove($search, $subject){ str_replace($search, "", $search); } $str = "Uno Dos Tres"; $result = str_remove("Dos", $str); echo $result; // Output: "Uno Tres" ?> It's quite useful for guestbooks and the like for filtering curse words or DHTML, as strip_tags() doesn't remove things like 'onClick="javascript:evilStuff()"' from allowed tags. ---- Manual Page -- http://www.php.net/manual/en/function.str-replace.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45140 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45140&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45140&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75411) next »