3v4l.org

run code in 500+ PHP versions simultaneously
<?php var_dump(PHP_FLOAT_DIG, strlen(50000)); var_dump(round( 5, 12), round((float) 5, 12), round(5.0, 12)); var_dump(round( 5, 15), round((float) 5, 15), round(5.0, 15)); // This will fail in PHP 8.4 and add a ton of 0's and a 1 after the decimal because the length of the number (past the decimal to the left) plus the length of the precision is one higher than the PHP_FLOAT_DIG value, but only for the float values var_dump(round( 50, 12), round((float) 50, 12), round(50.0, 12)); var_dump(round( 500, 12), round((float) 500, 12), round(500.0, 12)); var_dump(round( 5000, 12), round((float) 5000, 12), round(5000.0, 12)); // This will fail in PHP 8.4 and add a ton of 0's and a 1 after the decimal because the length of the number (past the decimal to the left) plus the length of the precision is one higher than the PHP_FLOAT_DIG value, but only for the float values var_dump(round( 50000, 12), round((float) 50000, 12), round(50000.0, 12)); var_dump(round( 50000, 11), round((float) 50000, 11), round(50000.0, 11)); // This will fail in PHP 8.4 and add a ton of 0's and a 1 after the decimal because the length of the number (past the decimal to the left) plus the length of the precision is one higher than the PHP_FLOAT_DIG value, but only for the float values

preferences:
42.8 ms | 487 KiB | 6 Q