François Pignon François Pignon - 6 months ago 45
PHP Question

How to explode a price

I'd like to explode my

$prix = 1,99
, with some PHP lines to simplify my CSS

Expected result:

$prix1 = 1
$prix2 = 99


Thanks

Answer

Try this:

$price1 = floor($price);
$price2 = ($price - $price1) * 100;