I want to create a function that returns the difference of a two string.
grey tiles 100 X 200 kitchen flooring
grey tiles 200 X 600 kitchen flooring
it will return "100 x 200" and "200 x 600".
i have been reading lots of blogs related to this concerns but none of them fit what I want.
most blogs point me to use the pear package the one with Text_Diff but I don't what to install pear package just for that. If you guys knows other approach, i will be great and much more appreciated.
I've done also with an approach using array_diff, which is totally wrong.
$s1="grey tiles 100 X 200 kitchen flooring"; $s2="grey tiles 200 X 600 kitchen flooring"; $sa1=explode(" ",$s1); $sa2=explode(" ",$s2); $diff1=array_diff($sa1,$sa2); $diff2=array_diff($sa2,$sa1); print_r($diff1); print_r($diff2);
i dont like this actually, its shame. the point is I should have to whole different words but array_diff actually compares all array index values regardless of the position. You guys have other approach?