3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sumPrice = 5.00; $subtotal = 0.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 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(4) "5.00" array(1) { ["has_voucher"]=> int(1) }