Typically I would assume that by cat you mean concatenation, but it doesn't seem proper here. But, assuming that is what you mean, you would just check for the same concatenation character (a comma) in both variables, like so:
if ( stristr($implode1, ",") && stristr($implode2, ",") ) {
// error
} else {
// success, do something
}
However, assuming you mean the same item being entered in both variables, in this case fruit, you can check it this way:
$im1 = explode(",", $implode1);
$im2 = explode(",", $implode2);
foreach($im1 as $i) {
if ( array_search($i, $im2) ) {
// error
} else {
// success, do something
}
}
You could of course just search both strings for a given value, but I don't think that's what you're going for. But assuming it is, here is that code:
$duplicate = "apple"; // the item you are searching for a duplicate of
if ( stristri($implode1, $duplicate) && stristr($implode2, $duplicate) ) {
// error
} else {
// success, do something
}