- var_dump: documentation ( source)
- sprintf: documentation ( source)
<?php
class MyDateTime{
public $year, $month, $day, $hour, $minute, $second;
public function __debugInfo() {
return
$this->year . "-" . $this->month . "-" . $this->day .
sprintf("%02d:%02d:%02d", $this->hour, $this->minute, $this->second);
}
}
$dt = new MyDateTime();
$dt->year = 2014; $dt->month = 9; $dt->day = 20;
$dt->hour = 16; $dt->minute = 2; $dt->second = 41;
var_dump($dt);
?>