3v4l.org

run code in 300+ PHP versions simultaneously
<?php define( 'MINUTE_IN_SECONDS', 60 ); define( 'HOUR_IN_SECONDS', 60 * MINUTE_IN_SECONDS ); function current_time_61( $gmt_offset ) { return time() + (int) ( $gmt_offset * HOUR_IN_SECONDS ); } function current_time_62( $gmt_offset ) { return time() + ( (int) $gmt_offset * HOUR_IN_SECONDS ); } function current_time_621( $gmt_offset ) { return time() + (int) ( (float) $gmt_offset * HOUR_IN_SECONDS ); } var_dump( current_time_61( 5.5 ) ); var_dump( current_time_62( 5.5 ) ); var_dump( current_time_621( 5.5 ) );
Output for 8.0.1 - 8.0.29, 8.1.0 - 8.1.20, 8.2.0 - 8.2.7
int(1687445730) int(1687443930) int(1687445730)

preferences:
46.83 ms | 406 KiB | 5 Q