我想使用->format()
将日期对象输出为字符串,但是当我返回函数php时会自动将其转换为字符串?我该如何防止这种情况?
function setPassword($currOrder) {
$checkInDate = $currOrder->checkInDate; // return date object
$checkIndate = $checkInDate->format('j/m/Y');
print_r(gettype($checkIndate)); // output string
return $checkInDate;
}
print_r( gettype($thisGuest->setPassword($thisOrder)) ); // return object