note 81587 deleted from function.str-replace by felipe

From: Date: Sun, 23 Mar 2008 23:08:20 +0000
Subject: note 81587 deleted from function.str-replace by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-137437@lists.php.net to get a copy of this message
Note Submitter: samson_sap.at.yahoo.dot.com ---- you wanted to get rid of a bunch of characters: str_replace_all('#+-&~!@%^*(){}[]?<>,', '','myLengthy#+(String)'; output: myLengthyString function str_replace_all($search,$replace,$subject) { for($x=0;$x<strlen($search);$x++){ $search1 = substr($search,$x,1); while(strpos($subject,$search1)!==false) { $subject = str_replace($search1,$replace,$subject); } } return $subject; }

« previous php.notes (#137437) next »