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 - 7.1.0
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 20
Output for 5.1.0 - 5.1.1
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 0
Output for 5.0.4 - 5.0.5
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 Warning: strtotime(): Called with an empty time parameter. in /in/9kfkS on line 13 0
Output for 5.0.1 - 5.0.3
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Warning: strtotime(): Called with an empty time parameter. in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 Warning: strtotime(): Called with an empty time parameter. in /in/9kfkS on line 13 0
Output for 4.3.2 - 5.0.0
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Notice: strtotime(): Called with empty time parameter in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 Notice: strtotime(): Called with empty time parameter in /in/9kfkS on line 13 0
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 9 Notice: Undefined variable: row2 in /in/9kfkS on line 9 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/9kfkS on line 9 Notice: Use of undefined constant post_date - assumed 'post_date' in /in/9kfkS on line 13 Notice: Undefined variable: row2 in /in/9kfkS on line 13 Notice: strtotime() [http://www.php.net/function.strtotime]: Called with empty time parameter in /in/9kfkS on line 13 0