François Pignon François Pignon - 4 months ago 13
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;
Comments