+ 8
You can use like this..
<?php
session_start(); //It is important to use session
if( isset( $_SESSION['counter'] ) ) {
$_SESSION['counter'] += 1;
} else {
$_SESSION['counter'] = 1;
}
$msg = "You have visited this page ". $_SESSION['counter'];
$msg .= "in this session.";
?>
To end session..
<?php session_destroy(); ?>
It will destroy all the session variables.
Get more information From official website...
https://www.php.net/manual/en/reserved.variables.session.php



