3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sumPrice = 5.00; $subtotal = 5.00; $voucherSum = sprintf('%01.2f', (sprintf('%01.2f',$sumPrice) - sprintf('%01.2f',$subtotal))); $parameter['has_voucher'] = (abs($voucherSum) >= 0.01) ? 1 : 0; var_dump($voucherSum); var_dump($parameter);
Output for 4.3.0 - 7.2.0
string(4) "0.00" array(1) { ["has_voucher"]=> int(0) }