Pedro Chagas
asked on
Get identical words from two arrays
Hi E's, I have two arrays, and these arrays contain words. $array_one contain a single words and $array_two contain more then one word, like:
$array_one ---- Array ( [0] => one [1] => two [2] => five [3] => ten );
$array_two ---- Array ( [0] => one four [1] => one five numbers [2] => seven eleven [3] => ten ten world space);
What I want is a string, that in this case return (the repeat words between arrays divided by space):
$string = "one five ten";
Regards, JC
$array_one ---- Array ( [0] => one [1] => two [2] => five [3] => ten );
$array_two ---- Array ( [0] => one four [1] => one five numbers [2] => seven eleven [3] => ten ten world space);
What I want is a string, that in this case return (the repeat words between arrays divided by space):
$string = "one five ten";
Regards, JC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi @mokone, after echo $string; I put unset($string);. This is because I will use this code inside a while, and this new line is for $string not contain the last result.
Regards, JC
Regards, JC
Open in new window