Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
<form action = "" method = "GET">
<input name = "date">
<input type = "submit">
</form>
<?php
$date = date('d.m.Y');
$reg = "#(\d{2}).(\d{2}).\d{4}#";
preg_match($reg,$_GET['date'],$arr);
preg_match($reg,$date,$arr1);
echo $dr = date("z", mktime(0, 0, 0, $arr[2], $arr[1], 2022)).'</br>';
echo $present = 1+date("z", mktime(0, 0, 0, $arr1[2], $arr1[1], 2022)).'</br>';
if($dr<$present){
if(date('Y')%4 == 0){
echo (366-$present)+($present - ($present - $dr))+1;
} else {
echo (365-$present)+($present - ($present - $dr))+1;
}
} else if($dr>$present){
echo $dr - $present;
} else if($dr = $present){
echo 0;
}
?>