Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- preg replace with boundary and array


haamro - 8:56 pm on Sep 23, 2011 (gmt 0)


Hi there,

I am trying to delete words in the sentence contained in an array.

I cannot use str_replace, because it replaces that character within another word. (e.g. , if I try to delete "is"; "this" becomes "th")


So, I wanted to use preg_replace with boundary, but how do I add "/b" to the array ? ( I don't want to change my array)

$ignore=array("is","a","the");
$sentence="this is the way I want";

My output should be = "this way I want"

thanx


Thread source:: http://www.webmasterworld.com/php/4366534.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com