function substring_between_two_strings($s, $start, $end) {
$s = ' ' . $s;
$startpos = strpos($s, $start);
if ($startpos == 0) return '';
$startpos += strlen($start);
$len = strpos($s, $end, $startpos) - $startpos;
return trim(substr($s, $startpos, $len));
}
$s = 'PHP is a general-purpose scripting language especially suited to web development.';
$subs = substring_between_two_strings($s, 'especially', 'development');
echo $subs;
/*
run:
suited to web
*/