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

  • SEARCH
  • Home
  • 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 5967273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:55:13+00:00 2026-05-22T19:55:13+00:00

Newbie question i have following function: function isadult($description) { $bad=/*comma separated bad words*/; $bad=explode(,,$bad);

  • 0

Newbie question

i have following function:

function isadult($description)
{
$bad=/*comma separated bad words*/;
$bad=explode(",",$bad);
foreach($bad as $key)
{
if(eregi($key,$description))
{
return true;
}
}
return false;
}  


if (isadult($description)) exit;
else

this function apply only to variable $description if i want apply this function also to variable $title how to modify function ?
and eregi is deprecated how to change eregi with preg_match ?

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-22T19:55:14+00:00Added an answer on May 22, 2026 at 7:55 pm

    You can send both the $description and the $title variable to the function. The variable name provided in the function declaration is only refering to the variable name within the function scope, and not any variable names outside the function, even if they happen to be identical (as with $description in your case).

    Try if(isadult($title)) { and you will find that it will work.

    The value of the external variable $title is put into the function variable $description, and will be referred to as $description within the function scope (between { and })


    Since you’re not doing any actual regular expression matching in your example, you could just as well replace eregi() with stripos(), stristr() or similar…

    if(stripos($description, $key) !== false) {
    

    You should also define your bad words list as an array right away, instead of having php converting it.

    $bad = array('badword1','badword2','badword3');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a python newbie question: I have the following directory structure: test --
newbie question in css: I have the following style defined: TABLE.tabulardata th { font:
Newbie question for you. I have the following code. I get an error because
I have a newbie question: How do I invoke the following method: public void
Sorry for the newbie question. I have define a table in a following way
As being quite a newbie in linux, I have the follwing question. I have
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Pardon the dumb newbie question here; web programming isn't my forte... (blush) I have
This is sort of SQL newbie question, I think, but here goes. I have
Very primitive question but I am stuck (I guess being newbie). I have a

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.