<html>
<body>
$number = 123;
$txt = sprintf("With 2 decimals: %1\$.2f
<br>With no decimals: %1\$u",$number);
echo $txt;
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_func_string_sprintf3 by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:22:59 GMT -->
</html>