<?php $res = ['cpu', 'ram', 'hdd']; ?>
<?php
foreach ($res as $value) {
    ?>
    <h3><?php echo $value ?></h3></br>
    <img src=<?php echo Yii::getAlias('@web') . "/graphs/" . $value . "_" . $often . ".gif" ?>>
    </br>
    <?php
}
?>