str_replace problem
<p>I am trying to change title data into URL. I need to get rid off all text starting from "deadline" from the following dynamic data which I get from $title:</p>

<p>New York <strong>deadline May 14th, 2010 (urgent)</strong><br/>
New Hampshire <strong>deadline May 19th, 2010</strong><br/>
New Jersey <strong>deadline</strong></p>

<p>I expect the result should be like this<br/>
new-york<br/>
new-hampshire<br/>
new-jersey</p>

<p>Here is the code I have tried</p>

<pre><code>$newurl = strip_tags(str_replace("deadline","","$title"));
$code_entities_match = array( '&amp;quot;' ,'!' ,'@' ,'#' ,'$' ,'%' ,'^' ,'&amp;' ,'*' ,'(' ,')' ,'+' ,'{' ,'}' ,'|' ,':' ,'"' ,'&lt;' ,'&gt;' ,'?' ,'[' ,']' ,'' ,';' ,"'" ,',' ,'.' ,'_' ,'/' ,'*' ,'+' ,'~' ,'`' ,'=' ,' ' ,'---' ,'--','--');
$code_entities_replace = array('' ,'-' ,'-' ,'' ,'' ,'' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'' ,'-' ,'' ,'-' ,'-' ,'' ,'' ,'' ,'' ,'' ,'-' ,'-' ,'-','-');
$newtitle = str_replace($code_entities_match, $code_entities_replace, $newurl);
$urltitle = strtolower($newtitle);
</code></pre>

<p>Unfortunately, the results are:<br/>
new-york-deadline-may-14th-2010-urgent<br/>
new-hampshire-deadline-may-19th-2010<br/>
new-jersey-</p>

<p>Anyone can help?</p>
