PHP 8.4: SUNFUNCS_RET_*
constants deprecated
In PHP 8.4, the constants SUNFUNCS_RET_TIMESTAMP
, SUNFUNCS_RET_STRING
, and SUNFUNCS_RET_DOUBLE
are deprecated.
These constants were only used as parameters for the date_sunrise
and date_sunset
functions, which were deprecated in PHP 8.1.
The alternative for the date_sunrise
and date_sunset
functions is the date_sun_info
function, which does not require any of the deprecated constants.
Backward Compatible Impact
The SUNFUNCS_RET_TIMESTAMP
, SUNFUNCS_RET_STRING
, and SUNFUNCS_RET_DOUBLE
constants are deprecated, and using them emits a deprecation notice in PHP 8.4 and later.
The recommended alternative is the date_sun_info
function, which returns an array of information including the sunset and sunrise time (as UNIX timestamps) for given coordinates and a timestamp. Use the DateTime
class or date_*
functions to convert the timestamp to SUNFUNCS_RET_STRING
and SUNFUNCS_RET_DOUBLE
equivalents.
Related Changes
SUNFUNCS_RET_TIMESTAMP
SUNFUNCS_RET_STRING
SUNFUNCS_RET_DOUBLE
RFC Implementation