Couldn't you just use the actual substr() function, only like this:
substr($string,$start,($end-$start+1));
Or if you use it quite often, just functionize it,
function jsSubstring($string,$start,$end) {
$length = $end - $start + 1;
return substr($string,$start,$length);
}
Just an idea..tell me if it works!