do you have a PHP function to calculate subtotal?

im writing a simple script and would like to have a function that calculates the total and subtotal for me including the sales tax

if you have it, please send it to me