<?php
$str = 'abcdefgh';
$n = 2;
$m = 3;
echo substr($str, $n, $m), ; 
echo substr($str, $n), ; 
echo substr($str, 0, -1), ; 
echo substr($str, strpos($str, 'd'), $m), ; 
echo substr($str, strpos($str, 'de'), $m), ; 
?>