Character matching

Given two strings, demonstrate the following 3 types of matchings:

  1. Determining if the first string starts with second string
  2. Determining if the first string contains the second string at any location
  3. Determining if the first string ends with the second string

Optional requirements:

  1. Print the location of the match(es) for part 2
  2. Handle multiple occurrences of a string for part 2.

Haystack:

Needle:  

Press to invoke chmx.php.