有没有办法重复一个字符串任意次数?我有这段代码,我觉得应该有一种更简单的方法。
    $vitals = parent::userVitals($uid);
    $hearts = round($vitals['health']/25);
    /* with our powers combined! */
    if($hearts == 4)
    {
        $health = "♥♥♥♥";
    }
    elseif($hearts == 3)
    {
        $health = "♥♥♥";
    }
    elseif($hearts == 2)
    {
        $health = "♥♥";
    }
    elseif($hearts == 1)
    {
        $health = "♥";
    }
    return $health;