- printf: documentation ( source)
<?php
$options = ['style' => 'left'];
$radios = [
'right' => 'Right <em>(Default)</em>',
'left' => 'Left',
'fade' => 'Fade',
];
foreach ($radios as $value => $text) {
printf(
"<label><input type='radio' name='navbar_style[style]' value='%s'%s>%s</label>\n",
$value,
($options['style'] ?? '') === $value ? ' checked' : '',
$text
);
}