From: Eric Christopherson Date: 2012-04-26T05:28:19+09:00 Subject: Re: matching substrings On Wed, Apr 25, 2012 at 2:48 PM, Clay Tzoucalis wrote: > I need a little help with an assignment. Following is the code I am > being asked to create, any help with this would be great. > > Ask the user to enter two strings, a and b. Then return the number of > positions where they contain the same length 2 substring. So “xxcaazz” > and “xxbaaz” yields 3, since the “xx”, “aa”, and “az” substrings appear > in the same place in both strings. > > string_match('xxcaazz', 'xxbaaz') → 3 > string_match('abc', 'abc') → 2 > string_match('abc', 'axc') → 0 We generally don't do homework outright on this forum/list. Perhaps you could write up some code, see if it works, and if not, post it here and we can discuss how to improve it.