Maybe I’m missing the point… but
$string = "hello how are you today";
$string = substr($string,0,21); // returns " hello how are you tod"
or you can write
$string = substr($string,0,(strlen($string)-2)); // returns " hello how are you tod"
If you want to count backwards, you can write like this
$string = substr($string,-2); // returns "ay"