Having an issue where literal comparing of 2 Carbon objects are not equal, and I'm not sure why, I have posted my tinker session below to show the problem;
>>> $t = Carbon\Carbon::today()
=> Carbon\Carbon @1548025200 {#3026
date: 2019-01-21 00:00:00.0 Europe/Berlin (+01:00),
}
>>> $f = Carbon\Carbon::parse('21-01-2019 10:02:01')->startOfDay()
=> Carbon\Carbon @1548025200 {#3035
date: 2019-01-21 00:00:00.0 Europe/Berlin (+01:00),
}
>>> $f === $t
=> false
>>> $f == $t
=> true
>>> echo $t
2019-01-21 00:00:00⏎
>>> echo $f
2019-01-21 00:00:00⏎
>>>
Just wondering why $f === $t
is false,
Thanks for anyone that can help!
Also even using today()
for both returns false; (But in case either of these have different solutions, the first example is more applicable to my issue)
>>> $t = Carbon\Carbon::today()
=> Carbon\Carbon @1548025200 {#3033
date: 2019-01-21 00:00:00.0 Europe/Berlin (+01:00),
}
>>> $f = Carbon\Carbon::today()
=> Carbon\Carbon @1548025200 {#3038
date: 2019-01-21 00:00:00.0 Europe/Berlin (+01:00),
}
>>> $f === $t
=> false
>>> $f == $t
=> true