PHP sprintf

sprintf('"%s" <%s> (%s) [%s]', a, b, c, d);

will not display <%s>

I get "a" (c) [d] not "a" <b> (c) [d]

do I need some escape character or something?
mosemadlAsked:
Who is Participating?
 
Greg AlexanderConnect With a Mentor Lead DeveloperCommented:
Just a thought

<?= sprintf('"%s" &lt;%s&gt; (%s) [%s]', a, b, c, d); ?>

Open in new window

0
 
Dave BaldwinFixer of ProblemsCommented:
Yes, all the options for use in sprintf() are on this page: http://www.php.net/manual/en/function.sprintf.php  To actually display a '%', you need two of them '%%'.
0
 
Chris StanyonCommented:
If you're outputting this in HTML you won't see the bit between <> because your page will think it's an HTML tag. View the source of your page and you'll see it, but to render the < and > in HTML you need to use the HTML entities &lt; and &gt;

sprintf('"%s" &lt;%s%gt; (%s) [%s]', a, b, c, d);

Open in new window

0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
Greg AlexanderLead DeveloperCommented:
Sorry, didn't see that... don't give me points ;)
0
 
mosemadlAuthor Commented:
I don't need %

I need <b>

The less than symbol is the issue.
0
 
Chris StanyonCommented:
@mosemadl - have you just cross-posted or did you miss my post completely?
0
 
mosemadlAuthor Commented:
Sorry galexander07. That's exactly it.
0
 
Chris StanyonCommented:
I seem to be having another invisible day :/
0
All Courses

From novice to tech pro — start learning today.