I have to subtract a number from another number, but the script must verify that this is possible without giving a negative number.
For example, the client’s credit is $5.00. They want to make a purchase of $20, now they are short by $15 so they cannot make the purchase. Now it must redirect them to a page (Insuffient funds).
EDIT: This question screams that you’ve not sufficiently learned the basics. You should go read about flow constructs and conditionals and such, things like this will become much much easier if you do.