Welcome Guest, Not a member yet? Register   Sign In
How does *s work?
#1

[eluser]webnology[/eluser]
Hi all,

in the language file of dx_auth I have the following code (excerpt):

Code:
// Email content
$lang['auth_account_content'] = "Welcome to %s,

Thank you for registering. Your account was successfully created.

You can login with either your username or email address:

Login: %s
Email: %s
Password: %s

Can anyone tell me how the %s is being used? How can it post sth different for the login and for the pwd, when it's always %s?

All help appreciated,
Michel
#2

[eluser]GSV Sleeper Service[/eluser]
I've never used dx_auth, but %s usually means that string is being processed by sprintf() - %s is a place holder for a string in printf() and sprintf()
#3

[eluser]wiredesignz[/eluser]
http://php.net/sprintf

EDIT:
Beaten by GSV. Wink
#4

[eluser]webnology[/eluser]
The strange thing is that the whole string is being sent to the language string, where %s represents the string. When filling in the corresponding items, the content seems shifted. So for login, we get the id, for email we get the login, for pwd, we get the email, etc,...
#5

[eluser]GSV Sleeper Service[/eluser]
you've got your replacement items in the wrong order then.
example
Code:
$str = "mary had a little %s it's %s was white as %s";
printf($str,"lamb","fleece","snow");//outputs "mary had a little lamb it's fleece was white as snow"




Theme © iAndrew 2016 - Forum software by © MyBB