CarbonInterval {#1680 ▼
interval: + 00:07:36.0
#tzName: null
#localMonthsOverflow: null
#localYearsOverflow: null
#localStrictModeEnabled: null
#localHumanDiffOptions: null
#localToStringFormat: null
#localSerializer: null
#localMacros: null
#localGenericMacros: null
#localFormatFunction: null
#localTranslator: null
+"y": 0
+"m": 0
+"d": 0
+"h": 0
+"i": 0
+"s": 456
+"f": 0.0
+"weekday": 0
+"weekday_behavior": 0
+"first_last_day_of": 0
+"invert": 0
+"days": false
+"special_type": 0
+"special_amount": 0
+"have_weekday_relative": 0
+"have_special_relative": 0
}
如何从此interval: + 00:07:36.0
对象访问此CarbonPeriod
值。
[CarbonInterval
具有一个称为cascade()
的功能,它将相应地填充其他字段。
哪个将返回carbonInterval
对象,如下所示。>>
+"y": 0 +"m": 0 +"d": 0 +"h": 0 +"i": 7 +"s": 36 +"f": 0.0
然后我们可以访问那些属性,或者我们可以调用
format('%H:%I:%s')
以获取所需的值。
示例
$carbonInterval->cascade()->format('%H:%I:%s')