public static cssStyleToArray ( string $style ) : array | ||
$style | string | the CSS style string |
return | array | the array representation of the CSS style |
public static function cssStyleToArray($style)
{
$result = [];
foreach (explode(';', $style) as $property) {
$property = explode(':', $property);
if (count($property) > 1) {
$result[trim($property[0])] = trim($property[1]);
}
}
return $result;
}