3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = date("Y-m-d"); $currentTime = date("H:i:s"); $row2['post_date'] = "2013-12-02 10:00:00"; $currentDateHour = date("H", strtotime($currentDate . " " . $currentTime)); // This is the date I'm pulling from the database, it only displays // when in strtotime for some reason. It displays accurately to what is in the mySQL DB $upDate = date("Y-m-d H", strtotime($row2['post_date'])); // Some variables to make life easier for later if statements if I ever get that far. Displays accurately. $upDatehour = date("H", strtotime($row2['post_date'])); // trying simple subtraction $hour = $currentDateHour - $upDatehour; // this is where the result is incorrect, what is wrong here? Any method I've tried gives me the same result, with or without strotime.. it's gotta be something simple, always is! print $hour;
Output for git.master, git.master_jit, rfc.property-hooks
11

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.61 ms | 401 KiB | 8 Q