calcolo iva php 1

calcolo iva php

$prezzo = 12.21;
$iva = 22;
$qty = 1;

$prezzo_tot = $prezzo * $qty;

$iva_val = ($prezzo_tot * $iva)/100;

$totale = $prezzo_tot + $iva_val;

echo number_format($totale, 2, '.', '');

Here is what the above code is Doing:
1. We’re defining a variable called $prezzo and assigning it a value of 12.21.
2. We’re defining a variable called $iva and assigning it a value of 22.
3. We’re defining a variable called $qty and assigning it a value of 1.
4. We’re defining a variable called $prezzo_tot and assigning it a value of $prezzo multiplied by $qty.
5. We’re defining a variable called $iva_val and assigning it a value of $prezzo_tot multiplied by $iva divided by 100.
6. We’re defining a variable called $totale and assigning it a value of $prezzo_tot plus $iva_val.
7. We’re using the number_format() function to format the $totale variable.

Similar Posts