Pionia Core

ToStringFormat

Trait ToStringFormat.

Handle global format customization for string cast of the object.

Table of Contents

Methods

resetToStringFormat()  : void
Reset the format used to the default when type juggling a Carbon instance to a string
setToStringFormat()  : void

Methods

resetToStringFormat()

Reset the format used to the default when type juggling a Carbon instance to a string

public static resetToStringFormat() : void

setToStringFormat()

public static setToStringFormat(string|Closure|null $format) : void
Parameters
$format : string|Closure|null
Tags
deprecated

To avoid conflict between different third-party libraries, static setters should not be used. You should rather let Carbon object being cast to string with DEFAULT_TO_STRING_FORMAT, and use other method or custom format passed to format() method if you need to dump another string format.

Set the default format used when type juggling a Carbon instance to a string.


        
On this page

Search results