Query to work out VAT within a price... how??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Query to work out VAT within a price... how??

Post by simonmlewis »

Does anyone know the PHP maths query to work out the VAT within a price?

ie. £10. (or $10 for the USA techy bods).

It's not 10 * 15%... because that would find 15% of 10 and add it on.

I need the element within 10 that is the VAT.

Hope someone can help.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Query to work out VAT within a price... how??

Post by Mark Baker »

Gross Price = Net Price * (1 + VAT)
Net Price = 10
VAT = 15%
=> Gross Price = 10 * (1 + 0.15)
=> 11.50

Net Price = Gross Price / (1 + VAT)
Gross Price = 10
VAT = 15%
=> Net Price = 10 / (1 + 0.15)
=> 8.695652174
Post Reply