The correct fix to your original code is:
$var = substr($percentage, 0, -2);
However, Installer's example expresses your intent more clearly, so I would recommend it. Unfortunately, both dagon's examples are wrong since the former simply returns the entire string and the latter does not account for percentages of more than one digit.