PHP Snippets: Sprintf

PHPThis 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 );

Continue Reading azurecurve’s Article on their blog

PHP Snippets: Sprintf

This post is part of the PHP Snippets series where I will be covering the basics of developing in PHP. The 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.

Blog Syndicated with azurecurve’s Permission

Author: Ian Grieve

Share This Post On