This is a quick one, I have an string that looks like this:
(grabbing it from values off a db). What is the quickest way to add them together?
I tried using some of the string to integer functions but it didn't do the trick. I can do it placing them into an array with explode then adding them, but I am sure there is a better way to do this. Even doing it as I grab them from the db:
Maybe do something here?
$price = number_format($row['price'], 2); // 2 decimals
$tax = ($price * number_format($row['tax'], 2) ) / 100;
$unitPrice = $tax + $price;
$totalPrice = ($tax + $price) * $row['quantity'];
$subTotal .= "$totalPrice+";
echo number_format($unitPrice, 2, ',', '.') ;