PHP Code:
using System;
using System.Collections.Generic;

public static class 
StringExtensions
{
    public static List<
StringGetAllStringsBetween(this String InputString StartString End)
    {
        List<
String> Return = new List<String>();
        
Int32 Result 0;
        
Int32 LResult 0;
        while ((
Result Input.GetOffsetBetween(StartEndResult)) != -1)
        {
            Return.
Add(Input.GetStringBetween(StartEndLResult));
            
LResult Result;
        }
        return Return;
    }

    public static 
String GetStringBetween(this String InputString StartString End)
    {
        return 
Input.GetStringBetween(StartEnd0);
    }

    public static 
String GetStringBetween(this String InputString StartString EndInt32 Offset)
    {
        if (
Offset Input.Length)
        {
            
Int32 StartPos = (Input.IndexOf(StartOffset) + Start.Length);
            if (
StartPos > -1)
            {
                
Int32 EndPos Input.IndexOf(EndStartPos);
                if (
EndPos > -1)
                {
                    return 
Input.Substring(StartPos, (EndPos StartPos));
                }
            }
        }
        return 
String.Empty;
    }

    private static 
Int32 GetOffsetBetween(this String InputString StartString EndInt32 Offset)
    {
        if (
Offset Input.Length)
        {
            
Int32 StartPos Input.IndexOf(StartOffset);
            if (
StartPos > -1)
            {
                
Int32 EndPos Input.IndexOf(End, (StartPos Start.Length));
                if (
EndPos > -1)
                {
                    return 
EndPos;
                }
            }
        }
        return -
1;
    }

Extends the string class.

Example usage;
String test = "test";
String result = test.GetStringBetween("t", "t");

result == "es"