How to add more than 1,000 microseconds in PHP 7+
There is a known bug in PHP7 that prevent user from adding more than 1,000 microseconds to a DateTime. I had to think for a little while before coming up with this function:
public static function addMicroSeconds($date_time_object, $microseconds){
$milliseconds = $microseconds / 1000;
$seconds_to_add = floor($milliseconds / 1000);
$milliseconds_to_add = $milliseconds % 1000;
$microseconds_to_add = $microseconds % 1000;
$date_time_object->modify('+ '. $seconds_to_add .' seconds');
$date_time_object->modify('+ '. $milliseconds_to_add .' milliseconds');
$date_time_object->modify('+ '. $microseconds_to_add .' microseconds');
return $date_time_object;
}