<?php
require_once('class/PriceRounder.php');
$priceRounder = new PriceRounder();
$priceRounder->setPrice(5.23);
$priceRounder->addRule('>', 0, '<', 50, 'make_equal', 50, true);
$priceRounder->addRule('>', 50, '<=', 99, 'next_int', 0, true);
echo $priceRounder->getFinalPrice() . "<br />";
$priceRounder->setPrice(5.6);
echo $priceRounder->getFinalPrice() . "<br />";
$priceRounder->removeAllRules();
$priceRounder->addRule('>', 0, '<', 10, 'make_equal', 10, true);
$priceRounder->addRule('>', 10, '<', 20, 'make_equal', 20, true);
$priceRounder->addRule('>', 20, '<', 30, 'make_equal', 30, true);
$priceRounder->addRule('>', 30, '<', 40, 'make_equal', 40, true);
$priceRounder->addRule('>', 40, '<', 50, 'make_equal', 50, true);
$priceRounder->addRule('>', 50, '<', 60, 'make_equal', 60, true);
$priceRounder->addRule('>', 60, '<', 70, 'make_equal', 70, true);
$priceRounder->addRule('>', 70, '<', 80, 'make_equal', 80, true);
$priceRounder->addRule('>', 80, '<', 90, 'make_equal', 90, true);
$priceRounder->addRule('>', 90, '<=', 99, 'next_int', 0, true);
echo $priceRounder->getFinalPrice() . "<br />";
$priceRounder->setPrice(5.02);
echo $priceRounder->getFinalPrice() . "<br />";
$priceRounder->removeAllRules();
$priceRounder->addRule('>', 0, '<', 50, 'make_equal', 50, true, 5, 10);
echo $priceRounder->getFinalPrice() . "<br />";
$priceRounder->setPrice(3.25);
echo $priceRounder->getFinalPrice() . "<br />";
?>
|