Word filter: Do not differentiate between capital letters, minuscules and accents

Asked

Viewed 252 times

1

I need a word filter system for a text, but I can’t find any way not to differentiate between capital letters, minuscule letters and accents. Text example:

The fire is high! How can I put out this fire? The fire is high?

I need it to Filtre the word fire and replace it with water. The result would be:

The water is high! How will I turn off this water? The water is high?

NOTE: The words to be filtered are in a table in the database.

  • I think the str_ireplace would be sufficient for uppercase and minuscule, http://php.net/manual/en/function.str-ireplace.php.

  • Take a look therein, is a start. @Inkeliz

  • The very one str_ireplace indicated by Inkeliz allows receiving a list of elements to search and their substitutions. Soon you can do everything with just a call to the function

  • Wordpress has a function remove_accents that implements something similar (actually removes the accents, but it’s a way to get started). You can see the implementation here: https://developer.wordpress.org/reference/functions/remove_accents/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.