-2

I wanted to check to enter data into the database.Checks are as follows

$implode1 = "cat, dog, chicken";

$implode2 = "cow, goat, cat";

If the cat in the variable $implode1 is also contained in the variable $implode2, it should display a warning message. How to code for the above problem?

Help me please :(

user1798945
  • 145
  • 1
  • 2
  • 7

1 Answers1

0
$intersaction = array_intersect(array("cat", "dog", "chicken"), 
                                array("cat", "cow", "goat")    );

if (isset($intersaction["cat"])) {....}

Function is here

Denis Ermolin
  • 5,530
  • 6
  • 27
  • 44