This post is part of the PHP Snippets series where I will be covering the basics of developing in PHP.
The sprintf
function provides the same functionality as the printf function, but silently.
This means you would either need to echo the output or concatenate it with a string and echo that string.
$number = 500;
$string = 'miles';
echo sprintf( 'But I would walk %d %s', $number, $string );
Click to show/hide the PHP Snippets Series Index
PHP Snippets |
---|
Echo |
Quotes |
Printf |
Sprintf |
If Statements |
What should we write about next?
If there is a topic which fits the typical ones of this site, which you would like to see me write about, please use the form, below, to submit your idea.