i18n\Formatter format()

format() public method

Formats the value based on the given format type.

This method will call one of the "as" methods available in this class to do the formatting. For type "xyz", the method "asXyz" will be used. For example, if the format is "html", then asHtml() will be used. Format names are case insensitive.

public string format ( $value, $format )
$value mixed

The value to be formatted.

$format string|array

The format of the value, e.g., "html", "text". To specify additional parameters of the formatting method, you may use an array. The first element of the array specifies the format name, while the rest of the elements will be used as the parameters to the formatting method. For example, a format of ['date', 'Y-m-d'] will cause the invocation of asDate($value, 'Y-m-d').

return string

The formatting result.

throws yii\base\InvalidParamException

if the format type is not supported by this class.

doc_Yii
2016-10-30 17:06:04
Comments
Leave a Comment

Please login to continue.