Menu
Hi!
I’m wondering about if there is an easy way of calculating the intersection of the letters in two strings, with PHP?
I know I could make arrays of the strings by exploding them, and then use the array_intersect, and then imploding them to get the value I’m after.. But it seems like an unnecessary amount of steps to get that value..
So.. and “example” of what I’m after:
[CODE]
$string1 = “mama”;
$string2 = “papa”;
$intersection = $string1 ∩ $string2;
echo $intersection; //I want this to write “aa”
Cheers,
Artheus