php - Extract only the number of the day of the date and compare it with the current one

one text

Solution:

You are comparing timestamps, which are measured in seconds. What you are doing is effectively comparing two different points in time, not the days of the month.

You really should be using DateTime. If you want to compare only the day part then you can do something like this.

$dt1 = new DateTime($registrazione);
$dt2 = new DateTime(); // defaults to now

if($dt1->format('d') === $dt2->format('d')) {
    echo "Yes, it's the same day of the month";
} else {
    echo 'no!';
}

Source