[printf](<http://php.net/manual/en/function.printf.php>) will output a formatted string using placeholders

[sprintf](<http://php.net/manual/en/function.sprintf.php>) will return the formatted string

$name = 'Jeff';

// The `%s` tells PHP to expect a string
//            ↓  `%s` is replaced by  ↓
printf("Hello %s, How's it going?", $name);
#> Hello Jeff, How's it going?

// Instead of outputting it directly, place it into a variable ($greeting)
$greeting = sprintf("Hello %s, How's it going?", $name);
echo $greeting;
#> Hello Jeff, How's it going?

It is also possible to format a number with these 2 functions. This can be used to format a decimal value used to represent money so that it always has 2 decimal digits.

$money = 25.2;
printf('%01.2f', $money);
#> 25.20

The two functions [vprintf](<http://php.net/manual/en/function.vprintf.php>) and [vsprintf](<http://php.net/manual/en/function.vsprintf.php>) operate as [printf](<http://php.net/manual/en/function.printf.php>) and [sprintf](<http://php.net/manual/en/function.sprintf.php>), but accept a format string and an array of values, instead of individual variables.