3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $number = '01,234.50789'; $trunc = preg_replace( '/^.*?[0]*([\d\,]+)(([\.][\d]{0,2})([\d]*))?.*?$/', '$1$3', $number ); echo $trunc;
Output for 4.3.0 - 7.1.0
1,234.50