/** * Converts a array into a string representation. * * For example, * * ```php * print_r(Html::fromArray(['width' => '100px', 'height' => '200px'])); * // will display: 'width=100px; height=200px;' * ``` * * @param array $data list data * @return string */ public static function fromArray(array $data) { $result = ''; foreach ($data as $name => $value) { $value = StringHelper::toString($value, "'", Serialize::SERIALIZE_JSON); $result .= "{$name}={$value}; "; } return $result === '' ? null : rtrim($result); }