children('option') as $option) { // set attributes $attributes = array('type' => 'radio', 'name' => $name, 'value' => $option->attr('value')); // is checked ? if ($option->attr('value') == $value) { $attributes = array_merge($attributes, array('checked' => 'checked')); } printf(' %s ', $control->attributes($attributes), $option->text()); }