3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function toCents($amount) { $cents = explode(',', $amount); if (!isset($cents[1])) $cents[1] = '00'; return (int) implode($cents); } $amount = '10,95'; print toCents($amount); echo ' - '; $amount = '150'; echo toCents($amount);
based on 97Zfr
Output for 4.3.0 - 7.2.0
1095 - 15000