Jump to content
MakeWebGames

sprintf() review


BeastTheKidd

Recommended Posts

So, I know that sprintf formats the values for variables, and makes it easier to read in my opinion.

However, would I be correct to assume that if someone wanted to change a certain sentence, but still have all the variables update, it would work?

Example:

<?php

   $string = "Welcome Back, %s!";

       //Add value for %s
    $var1 = sprintf($string,"John");
    $var2 = sprintf($string,"Stan");

?>

 

Thanks,

- Dillion

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...