- sprintf: documentation ( source)
<?php
//echo sprintf("CONCAT(product.%1s, (case when product.%1s != '' then CONCAT(' - ',product.%1s) else '' end), (case when product.%1s != '' then CONCAT(' - ',product.%1s) else '' end))", "name");
echo sprintf('teste %1$s, 3: %3$s, 2: %2$s', "1", "2", "3");