This custom function is comparing two arrays, but if the arrays are completely different, i´ll get the error "Undefined variable: c". How can i fix this?
function myIntersect($a, $b) {
    foreach ($a as $x) {
        $i = array_search($x, $b);
        if ($i !== false) {
            $c[] = $x;
            unset($b[$i]);
        }
    }
    return $c;
}
Results:
$arrayone = array("3", "2", "1", "2", "3");
$arraytwo = array("1", "2", "3", "2", "1");
$result = myIntersect($arrayone, $arraytwo);
print_r($result); // ["3", "2", "1", "2"]
 
    