Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

How to get number of days between two dates in PHP

 IF your date grater than current date then

$now = time(); // or your date as well
$your_date = strtotime(“2010-01-01”);
$datediff = $your_date – $now;

echo round($datediff / (60 * 60 * 24));

IF your date less than current date then

$now = time(); // or your date as well
$your_date = strtotime(“2010-01-01”);
$datediff = $now – $your_date;

echo round($datediff / (60 * 60 * 24));

PHP Change default timezone India


Set default timezone set to India timezone in PHP.

date_default_timezone_set(“Asia/Kolkata”);


PHP Difference between Session and Cookie


The main difference between sessions and cookies is that sessions are stored on the server, and cookies are stored on the user’s computers in the text file format. Cookies can’t hold multiple variable while session can hold multiple variables..We can set expiry for a cookie,The session only remains active as long as the browser is open.Users do not have access to the data you stored in Session,Since it is stored in the server.Session is mainly used for login/logout purpose while cookies using for user activity tracking

Post a Comment

0 Comments