PHP sprintf vs. echo

I posted a question earlier tonight - PHP Wordpress quotes issue where some quotes were causing me some issues.

An answer was posted suggesting using echo sprintf. This looked very clean and took care of any variable & quoting issues that may occur. My question is, whats the disadvantage of using sprintf? If any?

Why do we use echo if it usually causes issues with mixing HTML and PHP. For reference this was the echoed statement:

echo "";

and the echo & sprintf:

echo sprintf(
    '', 
    get_bloginfo('template_url'), 
    $f['mainImage']
);

12
задан Community 23 May 2017 в 12:33
поделиться