getAttribute( 'style' ); if ( $original ) { foreach ( explode( ';', $original ) as $rule ) { $styles[] = $rule; } } foreach ( $margin as $key => $value ) { $styles[] = "margin-$key:$value"; } foreach ( $padding as $key => $value ) { $styles[] = "padding-$key:$value"; } $div->setAttribute( 'style', implode( ';', $styles ) ); $html = $dom->saveHTML(); } return $html; }