3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function roundToNextHour($dateString) { $date = new DateTime( $dateString ); $minutes = $date->format('i'); if($minutes > 0){ $date->modify("+1 hour"); $date->modify('-'.$minutes.' minutes'); } return $date; } echo roundToNextHour(date());
based on Q2JNI
Output for 7.1.0 - 7.2.0
Warning: date() expects at least 1 parameter, 0 given in /in/A4Aoo on line 13 Recoverable fatal error: Object of class DateTime could not be converted to string in /in/A4Aoo on line 13
Process exited with code 255.
Output for 5.4.0 - 7.0.20
Warning: date() expects at least 1 parameter, 0 given in /in/A4Aoo on line 13 Catchable fatal error: Object of class DateTime could not be converted to string in /in/A4Aoo on line 13
Process exited with code 255.