lordvader Posted June 7, 2008 Share Posted June 7, 2008 What does it mean when an example has %s and they say the %s is a string placeholder? Is that an actual php function or are they just using some kind of literary shorthand? If it is a php thing, how do I use it? thanks Quote Link to comment https://forums.phpfreaks.com/topic/109075-solved-how-to-use-s-quotstring-placeholderquot/ Share on other sites More sharing options...
DarkWater Posted June 7, 2008 Share Posted June 7, 2008 It is involved with the printf function (and sprintf, vsprintf, etc). http://www.php.net/printf ^^^ That has all the codes that you need. But here are examples: $lol = "Lol"; $num = 42; printf("My favorite number is %d and I love to %s", $num, $lol); //Prints "My favorite number is 42 and I love to Lol" Quote Link to comment https://forums.phpfreaks.com/topic/109075-solved-how-to-use-s-quotstring-placeholderquot/#findComment-559576 Share on other sites More sharing options...
lordvader Posted June 7, 2008 Author Share Posted June 7, 2008 Thanks DW Quote Link to comment https://forums.phpfreaks.com/topic/109075-solved-how-to-use-s-quotstring-placeholderquot/#findComment-559661 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.