3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "15.5 d value is ",sprintf('%d',15.5),"\n"; echo "15.5 e value is ",sprintf('%e',15.5),"\n"; echo "15.5 f value is ",sprintf('%f',15.5),"\n"; echo "15.5 g value is ",sprintf('%g',15.5),"\n"; echo "0.5 d value is ",sprintf('%d',0.5),"\n"; echo "0.5 e value is ",sprintf('%e',0.5),"\n"; echo "0.5 f value is ",sprintf('%f',0.5),"\n"; echo "0.5 g value is ",sprintf('%g',0.5),"\n"; echo "155 d value is ",sprintf('%d',155),"\n"; echo "155 e value is ",sprintf('%e',155),"\n"; echo "155 f value is ",sprintf('%f',155),"\n"; echo "155 g value is ",sprintf('%g',155),"\n";
Output for 5.2.1 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.31, 7.3.16 - 7.3.19, 7.4.0 - 7.4.8, 8.0.0alpha1 - alpha2
15.5 d value is 15 15.5 e value is 1.550000e+1 15.5 f value is 15.500000 15.5 g value is 15.5 0.5 d value is 0 0.5 e value is 5.000000e-1 0.5 f value is 0.500000 0.5 g value is 0.5 155 d value is 155 155 e value is 1.550000e+2 155 f value is 155.000000 155 g value is 155
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0
15.5 d value is 15 15.5 e value is 1.55000e+1 15.5 f value is 15.500000 15.5 g value is 0.5 d value is 0 0.5 e value is 5.00000e-1 0.5 f value is 0.500000 0.5 g value is 155 d value is 155 155 e value is 1.55000e+2 155 f value is 155.000000 155 g value is