why don't you just compare the times when they formed them again as follows:
if(strtotime($db_minus7) > strtotime($completion_date)) {
$can_invoiced = 'maybe';
} else {
$can_invoiced = 'Yes';
}
EDIT:
if you want to use date (), use "Ymd"either "Y-m-d"as a template, because it is a comparison of strings, and it is a logical order of work (sort the templates from "large" (years) to small (days ... or maybe seconds, if you necessary));
source
share