function stringIntersection($string1, $string2) {
// Convert strings to arrays of characters
$array1 = str_split($string1);
$array2 = str_split($string2);
// Find common characters
$intersection = array_intersect($array1, $array2);
// Convert the result back to a string and remove duplicates
return implode(',', array_unique($intersection));
}
$string1 = "php";
$string2 = "python";
$result = stringIntersection($string1, $string2);
echo "Intersection: " . $result;
/*
run:
Intersection: p,h
*/