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