PHP Classes

PHP notice message for badwords class

Recommend this page to a friend!

      badword  >  All threads  >  PHP notice message for badwords class  >  (Un) Subscribe thread alerts  
Subject:PHP notice message for badwords class
Summary:notice message
Messages:2
Author:Farzad
Date:2014-06-24 20:01:10
 

 


  1. PHP notice message for badwords class   Reply   Report abuse  
Picture of Farzad Farzad - 2014-06-24 20:01:10
First of all thank you for this useful class, really appreciate your effort!

Have 1 question, Ive used this class as said in the description, but I seem to be getting PHP notice message for this line;

********** $filter .="$wordreplace[$f]"; **********

And message as follows;

**********Notice: Undefined offset: 8 in C:\PHP\...\badwords.php on line 48 **********

and line 48 is what I added above! Ignore the asterisks as I added for better visibility :)

I would appreciate if you could explain why this is happening, many thanks

  2. Re: PHP notice message for badwords class   Reply   Report abuse  
Picture of Carl Leiner Carl Leiner - 2020-05-05 22:27:30 - In reply to message 1 from Farzad
add these two lines to sort badword list from largest to smallest

array_multisort(array_map('strlen',$badwords),$badwords);
$badwords=array_reverse($badwords);


This will insure all the profane word is removed and not just partially