3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.1.2 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 20
Output for hhvm-3.12.0
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Warning: strtotime() expects parameter 1 to be string, null given in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 Warning: strtotime() expects parameter 1 to be string, null given in /in/eUcvK on line 13 20
Output for 5.1.0 - 5.1.1
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 0
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 13 21
Output for 5.0.1 - 5.0.3
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 Warning: strtotime(): Called with an empty time parameter. in /in/eUcvK on line 13 21
Output for 4.3.2 - 5.0.0
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Notice: strtotime(): Called with empty time parameter in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 Notice: strtotime(): Called with empty time parameter in /in/eUcvK on line 13 21
Output for 4.3.0 - 4.3.1
Notice: Undefined variable: row2 in /in/eUcvK on line 9 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/eUcvK on line 9 Notice: Undefined variable: row2 in /in/eUcvK on line 13 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/eUcvK on line 13 21