Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1006839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:31:25+00:00 2026-05-16T08:31:25+00:00

I have to implement a bad words filter on my website, which is a

  • 0

I have to implement a “bad words” filter on my website, which is a classifieds website.

I have a big list of “bad words” but don’t know which method is best to compare the user inputs to.

In my case, a textarea inside a form, needs to be checked for “bad words”.

   <form name="test" action="test.php" method="post">

Inside test.php I fetch the textarea, and need to compare it…

My Q is, would you compare it to an external text-file with bad words, or an array with bad-words?

The array I think is better, so I don’t need any external functions etc, but I need to be sure…

What do you think?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:31:26+00:00Added an answer on May 16, 2026 at 8:31 am

    An array/list would be quicker overall if you are checking many words. You only have to read the file once and then each check will be against the list.

    However, in your application (assuming you want to go ahead despite the pitfalls) it might be better to read the file only when you need to. That way the file could be updated while the application is still running and you wouldn’t have to stop and restart the application or call some admin function to reparse the file.

    The delay in submission probably won’t be noticed by the user anyway. Though using a caching algorithm to see if the file has changed would minimise this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not very technical, but... I have to implement a bad words filter in a
I have a classifieds website, and on each classified there is a tip-form where
I have to implement the VinPower application. They offer a Java version, a C
I have to implement MPI system in a cluster. If anyone here has any
I have to implement a middleware system for file sharing, and it has to
Let's say I have to implement a piece of T-SQL code that must return
Working on a project at the moment and we have to implement soft deletion
For a project I have a specification with formulas, I have to implement. In
I was having a discussion with coworkers. We have to implement some security standards.
I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.