I am trying to learn more about the PHP function sprintf() but php.net did not help me much as I am still confused, why would you want to use it?
Take a look at my example below.
Why use this:
$output = sprintf("Here is the result: %s for this date %s", $result, $date);
When this does the same and is easier to write IMO:
$output = 'Here is the result: ' .$result. ' for this date ' .$date;
Am I missing something here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…