Calculate VAT Tax with PHP

Free Scripts :: PHP :: Mathematics :: Calculate VAT Tax with PHP

Author: Salman Javaid

Website: http://www.salman.be

  • How to calculate VAT against a price with PHP.
  • PHP function to calculate VAT.
  • Calculating tax against price with PHP.
  • Calculate total price including VAT.

This function calculates the vat against the price and adds it into the price. Function accepts 2 parameters. First parameter is VAT rate and the second parameter is the price.

Function

function vat($price,$vat=17.5) {
    $price_with_vat=0;
    $price_with_vat = $price + ($vat*($price/100));
    $price_with_vat = round($price_with_vat, 2);
    return $price_with_vat;
}

Calling The Function

echo vat(150);

Output

176.25

Comments

No comments. Be the first one.

Leave a comment

Full Name*
Comments*
Security Code*

Our Partners

Getty Icons  Salman Creations
Free High Quality Images  Learn Free Languages 
Opal Hosting  R-Tech Solutions
  • Submit a Script

    Click here to submit your script.