<?php foreach ($ar as $key => $value) { ?>
<?php ($value == $valueq) ? $selected = ' active' : $selected=''; ?>
<label for="<?php echo $id . '-' . $value; ?>" class="tleft">
<input type="radio" id="<?php echo $id . '-' . $value; ?>" name="<?php echo $name; ?>" value="<?php echo $value; ?>" <?php if ($valueq == $value) { ?>checked="checked"<?php }?>>
<?php echo $key; ?>
</label>
<?php } ?>