I’m having a problem using PHP’s ‘diff()’ or ‘date_diff()’ between two dates of mine. Basically when I run anything that attempts to compare dates or try to define something as a date the page will stop loading at that point.
<?php
// My starting point is the $dirty_date variable.
// It is collected from a string, parsed,
// and ends up being an integer-based date / seconds past Unix Epoch
//I am also including some echos along the way for debugging purposes.
echo "Check 1: ".$dirty_date."<br>";
$systemdate = date("U");
echo "Check 2: ".$systemdate."<br>";
//$interval = $dirty_date->diff($systemdate);
echo "check 3: ".$interval;
Here are the results:
Check 1: 1490781836
Check 2: 1490806703
check 3:
Check 3 returned nothing because I have the line which diffs it commented out. I have it commented out because if it is enabled, the page doesn't load anything else past that point.
->is used for objects.error_reporting(E_ALL); ini_set('display_errors', '1');$variable = new DateTime($dirty_date);but that also halts the page loading at that point as well.$dirty_date = \DateTime::setTimestamp($dirty_date);but as soon as I hit that line the PHP stops loading the page. I confirmed it's that line by commenting it out. As soon as I do $dirty_date starts echo'ing again.