PDA

View Full Version : Stripping Phrases From Start And End Of Thread Title


arlarson
06-17-2008, 11:57 PM
I'm trying to strip some phrases from the beginning and end of a thread title. I'm an amateur with coding, so I'm assuming I'm missing something basic. This doesn't work:
$newtitle = $vbulletin->GPC['subject'];
$bannedphrases = array ('question on','question for','question about','question','questions');
foreach ($bannedphrases as $word) {
$i = strlen($word);
if (substr($newtitle,0,$i) == $word) {$newtitle = substr($newtitle,$i);}
if (substr($newtitle,-$i,$i) == $word) {$newtitle = substr($newtitle,0,-$i);}
}
$vbulletin->GPC['subject'] = $newtitle;
I would appreciate any suggestions or tips on how to get on the clue bus. Thanks.