$a=I love India.
$b=India is my country.
in core php how can extract common word from these two variables.
$a=I love India.
$b=India is my country.
in core php how can extract common word from these two variables.
try this, the live demo
$a='I love India';
$b='India is my country';
print_r(array_intersect(explode(' ', $a), explode(' ', $b)));