I have a string and three sub strings:
$str = "smartphones";
$substr1 = "smart";
$substr2 = "phon";
$substr3 = "smartphone";
running the three substrings through a function should return 5, 4 and 10 respectively. If there's no match, it should return 0.
EDIT:
Also, if the string is "smartphones and other phones", $substr2
should still return 4, not 8