function calcTax($subTotal, $storeId) { $tax = new Tax(); $rs = $tax->taxRate($storeId); if (isset($rs[0])) { $taxRate = $rs[0]['rate']; return number_format(floatval($subTotal) * floatval($taxRate / 100), 2, '.', ' '); } else { return number_format(0, 2, '.', ' '); } }