I am having an error. A non well formed numeric value encountered. Kindly check my code below and guide me what I am doing wrong:
...
$i++;
$item_count += $item['quantity'];
$sub_total += ($product['price'] * $item['quantity']);
$sub_total = (float)$sub_total;
}
$tax_rate = 18;
$tax = ($tax_rate * $sub_total) / 100;
// Here I am having an error - A non well formed numeric value encountered
$tax = number_format($tax, 2); // 2 decimal digit
$grand_total = $tax + $sub_total;
Kindly suggest what I am doing wrong. Your suggestions would be welcome. Thank You