I would like to turn an int value (21, VAT) into a float (factor) 1.21. So that I can turn a product price into the price including tax.
Some function gives me the int 21, which I would gratefully like to use. I used so far;
Really ugly
$taxRate = 21; // this come from a function in PrestaShop in case you wonder
$factor = (float)"1.$taxRate"; // 1.21
Feels more savvy
$taxRate = 21;
$factor = 1+($taxRate/100); // 1.21
I really think I'm missing some function of other interesting syntax. I know it seems trivial but I feel both options are so ugly and long, and might even kick back later.