note 64097 added to function.floor

From: Date: Fri, 07 Apr 2006 10:26:58 +0000
Subject: note 64097 added to function.floor
Groups: php.notes 
Request: Send a blank email to php-notes+get-107507@lists.php.net to get a copy of this message
Having read the contribution by alhall below, I came up with this script to help calculate Value Added Tax (VAT) according to the UK regulation that VAT should be calculated DOWN to the nearest penny, at a rate of 17.5%. // in this example, we'll say the Net (pre VAT figure) is £15.00 // I've used number_format() to caculate the values to 2 decimal places $net = 15.00; $net = number_format($net, 2); // Calculate the VAT at 17.5% of the Net amount $vat = $net * 0.175; // Get the vat figure to two decimal places, rounded DOWN to the nearest penny $vat = floor(($vat * 100))/100; $vat = number_format($vat, 2); // Gross amount equals Net plus VAT, to two decimal places $gross = $net + $vat; $gross = number_format($gross, 2); // JOB DONE. ---- Server IP: 85.116.0.130 Probable Submitter: 80.46.103.21 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.floor.php Edit -- http://master.php.net/note/edit/64097 Del: integrated -- http://master.php.net/note/delete/64097/integrated Del: useless -- http://master.php.net/note/delete/64097/useless Del: bad code -- http://master.php.net/note/delete/64097/bad+code Del: spam -- http://master.php.net/note/delete/64097/spam Del: non-english -- http://master.php.net/note/delete/64097/non-english Del: in docs -- http://master.php.net/note/delete/64097/in+docs Del: other reasons-- http://master.php.net/note/delete/64097 Reject -- http://master.php.net/note/reject/64097 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107507) next »