3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = date("Y-m-d"); $currentTime = date("H:i:s"); $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
Warning: Undefined variable $row2 in /in/eUcvK on line 9 Warning: Trying to access array offset on value of type null in /in/eUcvK on line 9 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 9 Warning: Undefined variable $row2 in /in/eUcvK on line 13 Warning: Trying to access array offset on value of type null in /in/eUcvK on line 13 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 13 20
Output for rfc.property-hooks
Warning: Undefined variable $row2 in /in/eUcvK on line 9 Warning: Trying to access array offset on null in /in/eUcvK on line 9 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 9 Warning: Undefined variable $row2 in /in/eUcvK on line 13 Warning: Trying to access array offset on null in /in/eUcvK on line 13 Deprecated: strtotime(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/eUcvK on line 13 20

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:
44.1 ms | 402 KiB | 8 Q