3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $data['ealkalom'] = '2014. 04. 30. 00:00'; $data['valkalom'] = '2014. 04. 30. 00:00'; function checkInvalidHour($date) { $hour = ""; if(preg_match("/(2[0-3]|[01][0-9]):[0-5][0-9]/", $date, $match)) { list($hour, $min) = explode(":", $match[0]); } return $hour; } if(checkInvalidHour($data['ealkalom']) == "00" or checkInvalidHour($data['valkalom']) == "00") { $dateType = "Y. m. d."; } else { $dateType = "Y. m. d. H:i"; } print $dateType; print $data['ealkalom'] = date($dateType, $data['ealkalom']); print $data['valkalom'] = date($dateType, $data['valkalom']);
Output for 5.1.0 - 7.1.0
Y. m. d. Notice: A non well formed numeric value encountered in /in/CSrMY on line 19 1970. 01. 01. Notice: A non well formed numeric value encountered in /in/CSrMY on line 20 1970. 01. 01.
Output for 4.3.0 - 5.0.5
Y. m. d.1970. 01. 01.1970. 01. 01.