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:
$string1 = "mama";
$string2 = "papa";
$intersection = $string1 ∩ $string2;
echo $intersection; //I want this to write "aa"
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread