Level 9
No, you need to instantiate $date as Carbon object, and then you can compare 2 values
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Is it correct to compare between string date and carbon date?
$today = Carbon::today();
$date= '22-7-2017';
if($date > $today){
//.....
}
Please or to participate in this conversation.