troubleshooting Question

question, about how to execute an action on a simple array

Avatar of PeterdeB
PeterdeBFlag for Netherlands asked on
PHP
4 Comments1 Solution187 ViewsLast Modified:
I am trying to execute an action, on an array that is setup like following:

$textarea = "www, hoer";
$spams = array("http", "www", "viagra", "sex", "games");

 foreach ($spams as $array) {
if ( eregi($spams,$textarea ) ) {
      echo "Something went wrong";
      exit;
 }
}

As you will guess, it should execute what is between {} if it finds any of the words which are in the array, present in the text area

I have tried this with for (i=0;i<4;i++) but both of them generate errors, which after fixed, result in an empty output page after deliberately testing

thank you heaps
ASKER CERTIFIED SOLUTION
glcummins

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros