I have two strings
$str_original='This is first string';
$user_string='This is user string';
i want to get all the words that are matching with str_original string
Required output:
This is string
I can get this results using loop but is there any faster way to achieve this result using any function.
Thanks
>Solution :
This problem has already been answered here:
Php compare strings and return common values
You can just replace the string with the variables while calling the function common from the above solved answer:
Replace:
echo common('Product Name - Blue','Blue Green Pink Black Orange');
With:
echo common($str_original,$user_string);
where you can make str_original and user_string dynamic.