is ": %s" a variable or not

Home Forums Legacy Support Support queries How-to & Troubleshooting is ": %s" a variable or not

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #217952
    schneidi
    Spectator
    I translate strings and have an understanding problem. Follow string" Latest News : %s for course : %s". Belongs ":" to the variable ": %s" or not?
    #218064
    logan
    Member
    Pal :) yes it is very important. with printf or sprintf characters preceded by the % sign are placeholders (or tokens). They will be replaced by a variable passed as an argument.

    Example:

    $str1 = 'best'; $str2 = 'world'; $say = sprintf('Tivie is the %s in the %s!', $str1, $str2); echo $say;

    This will output:

    Tivie is the best in the world!

    Note: There are more placeholders (%s for string, %d for dec number, etc...).

    #218233
    schneidi
    Spectator
    The placeholder is only (%s) or is colon a part of the placeholder (: %s)?
    #218248
    logan
    Member
    Hey,
    is used for the readability. you can replace it with +,*,-,= etc.
Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘is ": %s" a variable or not’ is closed to new replies.