yii\helpers\BaseHtml::cssStyleFromArray PHP Méthode

cssStyleFromArray() public static méthode

For example, php print_r(Html::cssStyleFromArray(['width' => '100px', 'height' => '200px'])); will display: 'width: 100px; height: 200px;'
public static cssStyleFromArray ( array $style ) : string
$style array the CSS style array. The array keys are the CSS property names, and the array values are the corresponding CSS property values.
Résultat string the CSS style string. If the CSS style is empty, a null will be returned.
    public static function cssStyleFromArray(array $style)
    {
        $result = '';
        foreach ($style as $name => $value) {
            $result .= "{$name}: {$value}; ";
        }
        // return null if empty to avoid rendering the "style" attribute
        return $result === '' ? null : rtrim($result);
    }