DateInterval::__construct新しい DateInterval オブジェクトを作成する 説明
public DateInterval::__construct(string
$duration)新しい DateInterval オブジェクトを作成します。 パラメータ
エラー / 例外
変更履歴
例
例1 DateInterval オブジェクトを作成して使う例 上の例の出力は以下となります。 7
例2 DateInterval の例 上の例の PHP 8.2 での出力は、このようになります。:
object(DateInterval)#1 (10) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(9)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["from_string"]=>
bool(false)
}
上の例の PHP 8 での出力は、このようになります。:
object(DateInterval)#1 (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(9)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
上の例の PHP 7 での出力は、このようになります。
object(DateInterval)#1 (16) {
["y"]=>
int(0)
["m"]=>
int(0)
["d"]=>
int(2)
["h"]=>
int(0)
["i"]=>
int(0)
["s"]=>
int(0)
["f"]=>
float(0)
["weekday"]=>
int(0)
["weekday_behavior"]=>
int(0)
["first_last_day_of"]=>
int(0)
["invert"]=>
int(0)
["days"]=>
bool(false)
["special_type"]=>
int(0)
["special_amount"]=>
int(0)
["have_weekday_relative"]=>
int(0)
["have_special_relative"]=>
int(0)
}
参考
|