Calculate difference between two Dates Using Php

For calculating the day difference between two dates using Php. we already have a function for this in Php which can give us the date difference, the Function Named as date_diff().

So, let's look into the PHP date_diff() function basics and what are the parameters required to for the execution of the PHP date_diff() function. 

Basic Syntax:
date_diff(datetime1, datetime2, absolute)


In PHP date_diff() function first, two parameters are required and the third one is optional.which accepts the boolean value and by default, it's 'False'.

Let's take example to see the difference between dates:


<?php
    $startdate = date_create("2020-03-24");
    $enddate = date_create("2020-04-22");
    $difference = date_diff($date1, $date2);
    echo $difference->format("%R%a days");
?>

Output:

+29 days

Make XAMPP Control Panel Start Automatically on Windows Boot

If you want to start your xampp automatically when your system starts to avoid the start xampp control panel manually for PHP project. then you have an idea about how the other system software gets start in background i.e by your window startup folder application setting. where we have to just put our required software .exe shortcut file in that folder and when you click to switch on the computer it goes and check that which software has to start automatically from the startup folder setting.

Here just take a look to how to setup application shortcut to run on window startup:  

Step 1 

Open xampp control panel  from start menu

 

xampp_control_panel


 

Step 2

In the XAMPP Control Panel, click in the  Config button on top right corner above the Netstat button.
 
click_config_button


Step 3


Wait for a separate window to open. Review the Autostart of the modules section. Check the checkboxes for Apache and MySQL. Click Save and close the XAMPP Control Panel.
 
config_panel
 

After saving the setting if you start xampp control panel manually after the system start you need not click the start button to start the apache and MySQL service by this setting your autostart module service automatically starts on manual xampp control panel start. 

But we are seeking an idea for automatic start of xampp on windows start so follow further steps :

Step 4


Open the Windows Start Menu. Click on All Programs. Locate the Startup folder. Right Click on the Startup folder and click Open
But in some cases, its quit difficult to locate startup folder in windows so you go for the manual option to locate startup folder in windows
C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup  

startup_folder


Step 5


After locating the startup folder just drag and drop your software shortcut file in the startup folder or copy shortcut file and paste in the startup folder.
To locate your xampp shortcut file you have to make shortcut file by right click on xampp-control.exe 

open xampp folder by locating this path C:\xampp then right click and make shortcut file of application file
 
 shortcut making

after creating shortcut file you will get this type of file
 shirtcut_created

And at the end copy this file or drag file to drop in your startup folder and for checking its working or not shut down your pc and after a while switch on the pc check on bottom right corner your xampp start automatically.
 
paste_shortcut 
 
After all set, you can directly run your PHP project on the browser after pc starts.

For more details or queries you can ask in the comments  Thank You.