<?php printf('b: %b <br>c: %c <br>d: %d <bf>f: %f', 80,80, 80, 80); echo '<br />'; printf('%0.2f <br>%+d <br>%0.2f <br>', 8, 8, 1235.456); printf('the cost of %d %s at $%0.2f each is $%0.2f.', 4, 'brooms', 8.50, (4*8.50)); echo '<br>'; $tax = 30; printf('The tax rate is %0.2f%%', $tax);
The above has introduced the application of printf and sprintf, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.