$result = substr("Hello How are you", 0, 5); //first 5 chars "Hello"
$newstring = substr($dynamicstring, -7);